diff --git a/.github/actions/setup-deno/action.yaml b/.github/actions/setup-deno/action.yaml index 6c6f30b6a..71a6be0ff 100644 --- a/.github/actions/setup-deno/action.yaml +++ b/.github/actions/setup-deno/action.yaml @@ -6,4 +6,4 @@ runs: steps: - uses: denoland/setup-deno@v2 with: - deno-version: 2.7.1 # Keep in sync with mise.toml + deno-version: 2.7.5 # Keep in sync with mise.toml diff --git a/CHANGES.md b/CHANGES.md index c1c744b8f..6ca206c5b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -41,12 +41,23 @@ To be released. ### @fedify/vocab-runtime + - Updated the preloaded JSON-LD context to + match the current [GoToSocial] v0.21+ namespace, adding new type terms + (`LikeRequest`, `LikeAuthorization`, etc.) and property terms + (`automaticApproval`, `manualApproval`, `interactingObject`, etc.) while + retaining deprecated terms (`always`, `approvalRequired`) for backward + compatibility. [[#453], [#622]] + - Added optional `FetchError.response` so callers can inspect the original failed HTTP response when remote document or key fetches return an HTTP error (such as `404 Not Found` or `410 Gone`). This enables higher-level APIs to distinguish transport failures from specific HTTP fetch failures. [[#611]] +[GoToSocial]: https://gotosocial.org/ +[#453]: https://github.com/fedify-dev/fedify/issues/453 +[#622]: https://github.com/fedify-dev/fedify/pull/622 + ### @fedify/cli - Added `--reverse` option to `fedify lookup` to reverse presentation order @@ -81,6 +92,21 @@ To be released. ### @fedify/vocab + - Added [GoToSocial] interaction controls vocabulary for expressing who + can like, reply to, or announce posts and for approving interactions. + [[#453], [#622]] + + - Added `InteractionPolicy` and `InteractionRule` typeless value + classes. + - Added `LikeRequest`, `ReplyRequest`, and `AnnounceRequest` activity + types for requesting interaction approval. + - Added `LikeAuthorization`, `ReplyAuthorization`, and + `AnnounceAuthorization` types for proving approved interactions. + - Added `Object.interactionPolicy`, `Object.approvedBy`, + `Object.getLikeAuthorization()`/`Object.likeAuthorizationId`, + `Object.getReplyAuthorization()`/`Object.replyAuthorizationId`, and + `Object.getAnnounceAuthorization()`/`Object.announceAuthorizationId`. + - Fixed `Endpoints.toJsonLd()` to no longer emit invalid `"type": "as:Endpoints"` in the serialized JSON-LD. The `as:Endpoints` type does not exist in the ActivityStreams vocabulary, and its presence diff --git a/deno.lock b/deno.lock index 1b93a1cc5..9608d537f 100644 --- a/deno.lock +++ b/deno.lock @@ -24,6 +24,7 @@ "jsr:@optique/config@~0.10.6": "0.10.6", "jsr:@optique/core@~0.10.6": "0.10.6", "jsr:@optique/run@~0.10.6": "0.10.6", + "jsr:@std/assert@*": "1.0.18", "jsr:@std/assert@0.224": "0.224.0", "jsr:@std/assert@0.226": "0.226.0", "jsr:@std/assert@^1.0.13": "1.0.18", @@ -46,6 +47,7 @@ "jsr:@std/internal@0.224": "0.224.0", "jsr:@std/internal@1": "1.0.12", "jsr:@std/internal@^1.0.12": "1.0.12", + "jsr:@std/internal@^1.0.6": "1.0.12", "jsr:@std/io@0.225": "0.225.3", "jsr:@std/json@^1.0.2": "1.0.2", "jsr:@std/jsonc@^1.0.2": "1.0.2", @@ -60,6 +62,7 @@ "jsr:@std/path@^1.1.4": "1.1.4", "jsr:@std/semver@^1.0.6": "1.0.8", "jsr:@std/testing@0.224": "0.224.0", + "jsr:@std/testing@0.224.0": "0.224.0", "jsr:@std/url@~0.225.1": "0.225.1", "jsr:@std/uuid@^1.0.9": "1.1.0", "jsr:@std/yaml@^1.0.8": "1.0.10", diff --git a/examples/fresh/deno.json b/examples/fresh/deno.json index 6a735b6c4..8d8c7c4a7 100644 --- a/examples/fresh/deno.json +++ b/examples/fresh/deno.json @@ -31,7 +31,8 @@ "dom.asynciterable", "dom.iterable", "deno.ns", - "deno.unstable" + "deno.unstable", + "deno.temporal" ], "jsx": "precompile", "jsxImportSource": "preact", diff --git a/mise.toml b/mise.toml index 78df8c729..fd4dce58b 100644 --- a/mise.toml +++ b/mise.toml @@ -1,6 +1,6 @@ [tools] bun = "1.2.22" -deno = "2.7.1" +deno = "2.7.5" node = "22" pnpm = "10.28.0" diff --git a/packages/fedify/src/federation/handler.test.ts b/packages/fedify/src/federation/handler.test.ts index 9ff081886..41c4e55f6 100644 --- a/packages/fedify/src/federation/handler.test.ts +++ b/packages/fedify/src/federation/handler.test.ts @@ -134,6 +134,7 @@ test("handleActor()", async () => { "https://w3id.org/security/data-integrity/v1", "https://www.w3.org/ns/did/v1", "https://w3id.org/security/multikey/v1", + "https://gotosocial.org/ns", { alsoKnownAs: { "@id": "as:alsoKnownAs", @@ -236,6 +237,7 @@ test("handleActor()", async () => { "https://w3id.org/security/data-integrity/v1", "https://www.w3.org/ns/did/v1", "https://w3id.org/security/multikey/v1", + "https://gotosocial.org/ns", { alsoKnownAs: { "@id": "as:alsoKnownAs", @@ -396,6 +398,7 @@ test("handleObject()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { Emoji: "toot:Emoji", Hashtag: "as:Hashtag", @@ -494,6 +497,7 @@ test("handleObject()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { Emoji: "toot:Emoji", Hashtag: "as:Hashtag", @@ -679,6 +683,7 @@ test("handleCollection()", async () => { "https://w3id.org/identity/v1", "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -704,6 +709,7 @@ test("handleCollection()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -802,6 +808,7 @@ test("handleCollection()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -871,6 +878,7 @@ test("handleCollection()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -936,6 +944,7 @@ test("handleCollection()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -1005,6 +1014,7 @@ test("handleCollection()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -1254,6 +1264,7 @@ test("respondWithObject()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { Emoji: "toot:Emoji", Hashtag: "as:Hashtag", @@ -1386,6 +1397,7 @@ test("respondWithObjectIfAcceptable", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { Emoji: "toot:Emoji", Hashtag: "as:Hashtag", @@ -1565,6 +1577,7 @@ test("handleCustomCollection()", async () => { "https://w3id.org/identity/v1", "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", @@ -1589,6 +1602,7 @@ test("handleCustomCollection()", async () => { const CONTEXT = [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { toot: "http://joinmastodon.org/ns#", misskey: "https://misskey-hub.net/ns#", diff --git a/packages/fedify/src/sig/proof.test.ts b/packages/fedify/src/sig/proof.test.ts index f78a40092..a50492821 100644 --- a/packages/fedify/src/sig/proof.test.ts +++ b/packages/fedify/src/sig/proof.test.ts @@ -82,8 +82,8 @@ test("createProof()", async () => { assertEquals( proof.proofValue, decodeHex( - "203e6afc5b7c6affe08d2d67ad100cc6cdcf1f5a438063d16766204956aa8fdd" + - "67cc04088ccf69de36225cab19377b5a032542fd2454b9b9dd001ffbdef5aa03", + "860dda2bec0ab493ae9b0223ac4133ee82246d7d75d6505be2d6c53755a34454" + + "dcb05feae02403ac51faf853d2e873d467f32a252d3b15a9f025e3ed0750b90b", ), ); assertEquals(proof.created, created); diff --git a/packages/fixture/src/fixtures/gotosocial.org/ns.json b/packages/fixture/src/fixtures/gotosocial.org/ns.json new file mode 100644 index 000000000..7907bb31f --- /dev/null +++ b/packages/fixture/src/fixtures/gotosocial.org/ns.json @@ -0,0 +1,86 @@ +{ + "@context": { + "xsd": "http://www.w3.org/2001/XMLSchema#", + "gts": "https://gotosocial.org/ns#", + "LikeRequest": "gts:LikeRequest", + "ReplyRequest": "gts:ReplyRequest", + "AnnounceRequest": "gts:AnnounceRequest", + "QuoteRequest": "gts:QuoteRequest", + "LikeAuthorization": "gts:LikeApproval", + "ReplyAuthorization": "gts:ReplyAuthorization", + "AnnounceAuthorization": "gts:AnnounceAuthorization", + "QuoteAuthorization": "gts:QuoteAuthorization", + "likeAuthorization": { + "@id": "gts:likeAuthorization", + "@type": "@id" + }, + "replyAuthorization": { + "@id": "gts:replyAuthorization", + "@type": "@id" + }, + "announceAuthorization": { + "@id": "gts:announceAuthorization", + "@type": "@id" + }, + "quoteAuthorization": { + "@id": "gts:quoteAuthorization", + "@type": "@id" + }, + "interactingObject": { + "@id": "gts:interactingObject", + "@type": "@id" + }, + "interactionTarget": { + "@id": "gts:interactionTarget", + "@type": "@id" + }, + "interactionPolicy": { + "@id": "gts:interactionPolicy", + "@type": "@id" + }, + "canLike": { + "@id": "gts:canLike", + "@type": "@id" + }, + "canReply": { + "@id": "gts:canReply", + "@type": "@id" + }, + "canAnnounce": { + "@id": "gts:canAnnounce", + "@type": "@id" + }, + "canQuote": { + "@id": "gts:canQuote", + "@type": "@id" + }, + "automaticApproval": { + "@id": "gts:automaticApproval", + "@type": "@id" + }, + "manualApproval": { + "@id": "gts:manualApproval", + "@type": "@id" + }, + "hidesToPublicFromUnauthedWeb": { + "@id": "gts:hidesToPublicFromUnauthedWeb", + "@type": "xsd:boolean" + }, + "hidesCcPublicFromUnauthedWeb": { + "@id": "gts:hidesCcPublicFromUnauthedWeb", + "@type": "xsd:boolean" + }, + "always": { + "@id": "gts:always", + "@type": "@id" + }, + "approvalRequired": { + "@id": "gts:approvalRequired", + "@type": "@id" + }, + "approvedBy": { + "@id": "gts:approvedBy", + "@type": "@id" + } + } +} diff --git a/packages/vocab-runtime/src/contexts.ts b/packages/vocab-runtime/src/contexts.ts index 1724fda70..2ba365680 100644 --- a/packages/vocab-runtime/src/contexts.ts +++ b/packages/vocab-runtime/src/contexts.ts @@ -4247,7 +4247,40 @@ const preloadedContexts: Record = { }, "https://gotosocial.org/ns": { "@context": { + "xsd": "http://www.w3.org/2001/XMLSchema#", "gts": "https://gotosocial.org/ns#", + "LikeRequest": "gts:LikeRequest", + "ReplyRequest": "gts:ReplyRequest", + "AnnounceRequest": "gts:AnnounceRequest", + "QuoteRequest": "gts:QuoteRequest", + "LikeAuthorization": "gts:LikeApproval", + "ReplyAuthorization": "gts:ReplyAuthorization", + "AnnounceAuthorization": "gts:AnnounceAuthorization", + "QuoteAuthorization": "gts:QuoteAuthorization", + "likeAuthorization": { + "@id": "gts:likeAuthorization", + "@type": "@id", + }, + "replyAuthorization": { + "@id": "gts:replyAuthorization", + "@type": "@id", + }, + "announceAuthorization": { + "@id": "gts:announceAuthorization", + "@type": "@id", + }, + "quoteAuthorization": { + "@id": "gts:quoteAuthorization", + "@type": "@id", + }, + "interactingObject": { + "@id": "gts:interactingObject", + "@type": "@id", + }, + "interactionTarget": { + "@id": "gts:interactionTarget", + "@type": "@id", + }, "interactionPolicy": { "@id": "gts:interactionPolicy", "@type": "@id", @@ -4264,6 +4297,26 @@ const preloadedContexts: Record = { "@id": "gts:canAnnounce", "@type": "@id", }, + "canQuote": { + "@id": "gts:canQuote", + "@type": "@id", + }, + "automaticApproval": { + "@id": "gts:automaticApproval", + "@type": "@id", + }, + "manualApproval": { + "@id": "gts:manualApproval", + "@type": "@id", + }, + "hidesToPublicFromUnauthedWeb": { + "@id": "gts:hidesToPublicFromUnauthedWeb", + "@type": "xsd:boolean", + }, + "hidesCcPublicFromUnauthedWeb": { + "@id": "gts:hidesCcPublicFromUnauthedWeb", + "@type": "xsd:boolean", + }, "always": { "@id": "gts:always", "@type": "@id", diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap index f8f537241..a5717ccc0 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap @@ -147,6 +147,17 @@ export class Object { #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + #_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; +#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; + + #_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; + #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + + #_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; + #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + + #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; + #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); /** * Constructs a new instance of Object with the given values. @@ -173,7 +184,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -1053,6 +1064,71 @@ proofs?: (DataIntegrityProof | URL)[];} ); } } + + if (\\"interactionPolicy\\" in values && values.interactionPolicy != null) { + if (values.interactionPolicy instanceof InteractionPolicy) { + // @ts-ignore: type is checked above. + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = [values.interactionPolicy]; + + } else { + throw new TypeError( + \\"The interactionPolicy must be of type \\" + + \\"InteractionPolicy\\" + \\".\\", + ); + } + } + + if (\\"approvedBy\\" in values && values.approvedBy != null) { + if (values.approvedBy instanceof URL) { + // @ts-ignore: type is checked above. + this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = [values.approvedBy]; + + } else { + throw new TypeError( + \\"The approvedBy must be of type \\" + + \\"URL\\" + \\".\\", + ); + } + } + + if (\\"likeAuthorization\\" in values && values.likeAuthorization != null) { + if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.add(0); + } else { + throw new TypeError( + \\"The likeAuthorization must be of type \\" + + \\"LikeAuthorization | URL\\" + \\".\\", + ); + } + } + + if (\\"replyAuthorization\\" in values && values.replyAuthorization != null) { + if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.add(0); + } else { + throw new TypeError( + \\"The replyAuthorization must be of type \\" + + \\"ReplyAuthorization | URL\\" + \\".\\", + ); + } + } + + if (\\"announceAuthorization\\" in values && values.announceAuthorization != null) { + if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0); + } else { + throw new TypeError( + \\"The announceAuthorization must be of type \\" + + \\"AnnounceAuthorization | URL\\" + \\".\\", + ); + } + } } /** @@ -1081,7 +1157,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} = {}, options: { @@ -1975,248 +2051,76 @@ proofs?: (DataIntegrityProof | URL)[];} ); } } + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + if (\\"interactionPolicy\\" in values && values.interactionPolicy != null) { + if (values.interactionPolicy instanceof InteractionPolicy) { + // @ts-ignore: type is checked above. + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = [values.interactionPolicy]; - return clone; - } - - async #fetchAttachment( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } + } else { + throw new TypeError( + \\"The interactionPolicy must be of type \\" + + \\"InteractionPolicy\\" + \\".\\", ); - return null; } - throw error; } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#attachment_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + if (\\"approvedBy\\" in values && values.approvedBy != null) { + if (values.approvedBy instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = [values.approvedBy]; + + } else { + throw new TypeError( + \\"The approvedBy must be of type \\" + + \\"URL\\" + \\".\\", ); - return null; } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } + } + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization;clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization); + if (\\"likeAuthorization\\" in values && values.likeAuthorization != null) { + if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set([0]); + } else { + throw new TypeError( + \\"The likeAuthorization must be of type \\" + + \\"LikeAuthorization | URL\\" + \\".\\", ); - return null; } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); } - }); - } - - async #attachment_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await PropertyValue.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\",\\"http://schema.org#PropertyValue\\"].join(\\", \\")); - } - - - /** - * Similar to - * {@link Object.getAttachments}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get attachmentIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies a resource attached or related to an object that potentially - * requires special handling. The intent is to provide a model that is at - * least semantically similar to attachments in email. - * - */ - - async* getAttachments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchAttachment(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"attachment\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"attachment\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attachment_fromJsonLd(obj, options); - } + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization;clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization); + if (\\"replyAuthorization\\" in values && values.replyAuthorization != null) { + if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set([0]); + } else { + throw new TypeError( + \\"The replyAuthorization must be of type \\" + + \\"ReplyAuthorization | URL\\" + \\".\\", + ); } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization;clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization); + if (\\"announceAuthorization\\" in values && values.announceAuthorization != null) { + if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set([0]); + } else { + throw new TypeError( + \\"The announceAuthorization must be of type \\" + + \\"AnnounceAuthorization | URL\\" + \\".\\", ); - continue; } - yield v; } - } - async #fetchAttribution( + return clone; + } + + async #fetchAttachment( url: URL, options: { documentLoader?: DocumentLoader, @@ -2225,7 +2129,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2258,7 +2162,7 @@ proofs?: (DataIntegrityProof | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#attribution_fromJsonLd( + const obj = await this.#attachment_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -2307,7 +2211,7 @@ proofs?: (DataIntegrityProof | URL)[];} }); } - async #attribution_fromJsonLd( + async #attachment_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -2315,7 +2219,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL } - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2325,25 +2229,7 @@ proofs?: (DataIntegrityProof | URL)[];} const baseUrl = options.baseUrl; try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( + return await Object.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2352,7 +2238,7 @@ proofs?: (DataIntegrityProof | URL)[];} } try { - return await Person.fromJsonLd( + return await Link.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2361,7 +2247,7 @@ proofs?: (DataIntegrityProof | URL)[];} } try { - return await Service.fromJsonLd( + return await PropertyValue.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2370,129 +2256,34 @@ proofs?: (DataIntegrityProof | URL)[];} } throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\",\\"http://schema.org#PropertyValue\\"].join(\\", \\")); } /** * Similar to - * {@link Object.getAttribution}, - * but returns its \`@id\` URL instead of the object itself. - */ - get attributionId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; - const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies one or more entities to which this object is attributed. - * The attributed entities might not be Actors. For instance, - * an object might be attributed to the completion of another activity. - * - */ - - async getAttribution( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; - let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchAttribution(v, options); - if (fetched == null) return null; - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"attributedTo\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"attributedTo\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#attribution_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; - } - - /** - * Similar to - * {@link Object.getAttributions}, + * {@link Object.getAttachments}, * but returns their \`@id\`s instead of the objects themselves. */ - get attributionIds(): URL[] { + get attachmentIds(): URL[] { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.map((v) => + return this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.map((v) => v instanceof URL ? v : v.id! ).filter(id => id !== null); } -/** Identifies one or more entities to which this object is attributed. - * The attributed entities might not be Actors. For instance, - * an object might be attributed to the completion of another activity. +/** Identifies a resource attached or related to an object that potentially + * requires special handling. The intent is to provide a model that is at + * least semantically similar to attachments in email. * */ - async* getAttributions( + async* getAttachments( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2500,27 +2291,27 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {} - ): AsyncIterable { + ): AsyncIterable { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAttribution(v, options); + await this.#fetchAttachment(v, options); if (fetched == null) continue; vs[i] = fetched; - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); this._cachedJsonLd = undefined; yield fetched; continue; @@ -2530,19 +2321,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"attributedTo\\" in this._cachedJsonLd + \\"attachment\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"attributedTo\\"]; + \\"attachment\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attribution_fromJsonLd(obj, options); + v = await this.#attachment_fromJsonLd(obj, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -2566,7 +2357,7 @@ proofs?: (DataIntegrityProof | URL)[];} } } - async #fetchAudience( + async #fetchAttribution( url: URL, options: { documentLoader?: DocumentLoader, @@ -2575,7 +2366,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2608,7 +2399,7 @@ proofs?: (DataIntegrityProof | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#audience_fromJsonLd( + const obj = await this.#attribution_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -2657,7 +2448,7 @@ proofs?: (DataIntegrityProof | URL)[];} }); } - async #audience_fromJsonLd( + async #attribution_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -2665,7 +2456,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL } - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2675,7 +2466,43 @@ proofs?: (DataIntegrityProof | URL)[];} const baseUrl = options.baseUrl; try { - return await Object.fromJsonLd( + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2684,34 +2511,35 @@ proofs?: (DataIntegrityProof | URL)[];} } throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); } /** * Similar to - * {@link Object.getAudience}, + * {@link Object.getAttribution}, * but returns its \`@id\` URL instead of the object itself. */ - get audienceId(): URL | null { + get attributionId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; - const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; + const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (v instanceof URL) return v; return v.id; } -/** Identifies one or more entities that represent the total population of - * entities for which the object can considered to be relevant. +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. * */ - async getAudience( + async getAttribution( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2719,26 +2547,26 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {} - ): Promise { + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; - let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; + let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAudience(v, options); + await this.#fetchAttribution(v, options); if (fetched == null) return null; - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(0); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(0); this._cachedJsonLd = undefined; return fetched; } @@ -2747,19 +2575,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"audience\\" in this._cachedJsonLd + \\"attributedTo\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"audience\\"]; + \\"attributedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#audience_fromJsonLd(doc, options); + v = await this.#attribution_fromJsonLd(doc, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -2784,27 +2612,28 @@ proofs?: (DataIntegrityProof | URL)[];} /** * Similar to - * {@link Object.getAudiences}, + * {@link Object.getAttributions}, * but returns their \`@id\`s instead of the objects themselves. */ - get audienceIds(): URL[] { + get attributionIds(): URL[] { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.map((v) => + return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.map((v) => v instanceof URL ? v : v.id! ).filter(id => id !== null); } -/** Identifies one or more entities that represent the total population of - * entities for which the object can considered to be relevant. +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. * */ - async* getAudiences( + async* getAttributions( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2812,27 +2641,27 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {} - ): AsyncIterable { + ): AsyncIterable { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAudience(v, options); + await this.#fetchAttribution(v, options); if (fetched == null) continue; vs[i] = fetched; - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); this._cachedJsonLd = undefined; yield fetched; continue; @@ -2842,19 +2671,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"audience\\" in this._cachedJsonLd + \\"attributedTo\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"audience\\"]; + \\"attributedTo\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#audience_fromJsonLd(obj, options); + v = await this.#attribution_fromJsonLd(obj, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -2878,36 +2707,7 @@ proofs?: (DataIntegrityProof | URL)[];} } } -/** The content or textual representation of the Object encoded as a JSON - * string. By default, the value of \`content\` is HTML. The \`mediaType\` - * property can be used in the object to indicate a different content type. - * - * The content MAY be expressed using multiple language-tagged values. - * - */ - get content(): (string | LanguageString | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) return null; - return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; - } - -/** The content or textual representation of the Object encoded as a JSON - * string. By default, the value of \`content\` is HTML. The \`mediaType\` - * property can be used in the object to indicate a different content type. - * - * The content MAY be expressed using multiple language-tagged values. - * - */ -get contents(): ((string | LanguageString))[] { - return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; - } - - async #fetchContext( + async #fetchAudience( url: URL, options: { documentLoader?: DocumentLoader, @@ -2916,7 +2716,7 @@ get contents(): ((string | LanguageString))[] { tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2949,7 +2749,348 @@ get contents(): ((string | LanguageString))[] { const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#context_fromJsonLd( + const obj = await this.#audience_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #audience_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getAudience}, + * but returns its \`@id\` URL instead of the object itself. + */ + get audienceId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; + const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async getAudience( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; + let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + if (fetched == null) return null; + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"audience\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"audience\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#audience_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Object.getAudiences}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get audienceIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async* getAudiences( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"audience\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"audience\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#audience_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ + get content(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) return null; + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ +get contents(): ((string | LanguageString))[] { + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; + } + + async #fetchContext( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#context_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -7810,174 +7951,861 @@ get urls(): ((URL | Link))[] { } } - /** - * Converts this object to a JSON-LD structure. - * @param options The options to use. - * - \`format\`: The format of the output: \`compact\` or - \`expand\`. - * - \`contextLoader\`: The loader for remote JSON-LD contexts. - * - \`context\`: The JSON-LD context to use. Not applicable - when \`format\` is set to \`'expand'\`. - * @returns The JSON-LD representation of this object. - */ - async toJsonLd(options: { - format?: \\"compact\\" | \\"expand\\", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], - } = {}): Promise { - if (options.format == null && this._cachedJsonLd != null) { - return this._cachedJsonLd; - } - if (options.format !== \\"compact\\" && options.context != null) { - throw new TypeError( - \\"The context option can only be used when the format option is set \\" + - \\"to 'compact'.\\" - ); - } - options = { - ...options, - contextLoader: options.contextLoader ?? getDocumentLoader(), - }; - - if (options.format == null && this.isCompactable()) { - const result: Record = {}; - // deno-lint-ignore no-unused-vars - let compactItems: unknown[]; - - compactItems = []; - for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { - const item = ( - v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Link ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); +/** The interaction policy for this object, specifying who can like, reply to, + * or announce it. Contains sub-policies (\`canLike\`, \`canReply\`, + * \`canAnnounce\`) each defining \`automaticApproval\` and \`manualApproval\` + * lists. + * + * When absent, implementations should assume anyone can interact with + * the object. Setting this property signals that the server understands + * and will enforce interaction controls. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * + */ + get interactionPolicy(): (InteractionPolicy | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length < 1) return null; + return this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[0]; } - if (compactItems.length > 0) { - result[\\"attachment\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - +/** A URI referencing an authorization object that proves this interaction + * was approved by the target post's author. + * + */ + get approvedBy(): (URL | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length < 1) return null; + return this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[0]; } - compactItems = []; - for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { - const item = ( - v instanceof URL ? v.href : v instanceof Application ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Group ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Organization ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Person ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); + async #fetchLikeAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#likeAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #likeAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL } - if (compactItems.length > 0) { + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await LikeAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - result[\\"attributedTo\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://gotosocial.org/ns#LikeApproval\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getLikeAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get likeAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < 1) return null; + const v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + if (v instanceof URL) return v; + return v.id; } - compactItems = []; - for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); - } - if (compactItems.length > 0) { +/** A {@link LikeAuthorization} object that proves this like interaction + * was approved by the target post's author. + * + */ + + async getLikeAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < 1) return null; + let v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchLikeAuthorization(v, options); + if (fetched == null) return null; + this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0] = fetched; + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } - result[\\"audience\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"likeAuthorization\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"likeAuthorization\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#likeAuthorization_fromJsonLd(doc, options); + } + } + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } - compactItems = []; - for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { - const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } - ); - compactItems.push(item); + async #fetchReplyAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#replyAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #replyAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL } - if (compactItems.length > 0) { + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await ReplyAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - result[\\"content\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://gotosocial.org/ns#ReplyAuthorization\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getReplyAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get replyAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < 1) return null; + const v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + if (v instanceof URL) return v; + return v.id; } - compactItems = []; - for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { - const item = ( - v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); - } - if (compactItems.length > 0) { +/** A {@link ReplyAuthorization} object that proves this reply was approved + * by the target post's author. + * + */ + + async getReplyAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < 1) return null; + let v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchReplyAuthorization(v, options); + if (fetched == null) return null; + this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0] = fetched; + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } - result[\\"context\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"replyAuthorization\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"replyAuthorization\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#replyAuthorization_fromJsonLd(doc, options); + } + } - } - - compactItems = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { - const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + async #fetchAnnounceAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#announceAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #announceAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await AnnounceAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://gotosocial.org/ns#AnnounceAuthorization\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getAnnounceAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get announceAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < 1) return null; + const v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** An {@link AnnounceAuthorization} object that proves this announce + * (boost) was approved by the target post's author. + * + */ + + async getAnnounceAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < 1) return null; + let v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAnnounceAuthorization(v, options); + if (fetched == null) return null; + this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0] = fetched; + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"announceAuthorization\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"announceAuthorization\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#announceAuthorization_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + const result: Record = {}; + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + const item = ( + v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Link ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"attachment\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + const item = ( + v instanceof URL ? v.href : v instanceof Application ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Group ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Organization ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Person ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"attributedTo\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"audience\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"content\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + const item = ( + v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"context\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } ); compactItems.push(item); } @@ -8501,9 +9329,105 @@ get urls(): ((URL | Link))[] { } + compactItems = []; + for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + const item = ( + await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactionPolicy\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + const item = ( + v.href + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"approvedBy\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"likeAuthorization\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"replyAuthorization\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"announceAuthorization\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + result[\\"type\\"] = \\"Object\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -9014,6 +9938,81 @@ get urls(): ((URL | Link))[] { } + array = []; + for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#interactionPolicy\\"] = propValue; + + } + + array = []; + for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + const element = ( + { \\"@id\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#approvedBy\\"] = propValue; + + } + + array = []; + for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#likeAuthorization\\"] = propValue; + + } + + array = []; + for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#replyAuthorization\\"] = propValue; + + } + + array = []; + for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#announceAuthorization\\"] = propValue; + + } + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Object\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { @@ -9023,7 +10022,7 @@ get urls(): ((URL | Link))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -9069,6 +10068,11 @@ get urls(): ((URL | Link))[] { this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0 ) return false; + if ( + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy != null && + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length > 0 + ) return false; + return true; } @@ -9171,6 +10175,18 @@ get urls(): ((URL | Link))[] { return await ChatMessage.fromJsonLd(json, options); } + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceAuthorization\\")) { + return await AnnounceAuthorization.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeApproval\\")) { + return await LikeAuthorization.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyAuthorization\\")) { + return await ReplyAuthorization.fromJsonLd(json, options); + } + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { return await Activity.fromJsonLd(json, options); } @@ -9179,6 +10195,18 @@ get urls(): ((URL | Link))[] { return await EmojiReact.fromJsonLd(json, options); } + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceRequest\\")) { + return await AnnounceRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeRequest\\")) { + return await LikeRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyRequest\\")) { + return await ReplyRequest.fromJsonLd(json, options); + } + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { return await Accept.fromJsonLd(json, options); } @@ -9415,7 +10443,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9569,7 +10597,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9655,7 +10683,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9758,7 +10786,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9801,7 +10829,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9849,7 +10877,7 @@ get urls(): ((URL | Link))[] { v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -10069,7 +11097,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -10360,6 +11388,144 @@ get urls(): ((URL | Link))[] { )) } instance.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + const _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; + + let _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array = values[\\"https://gotosocial.org/ns#interactionPolicy\\"]; + + for ( + const v of _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array == null + ? [] + : _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array.length === 1 && \\"@list\\" in _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array[0] + ? _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array[0][\\"@list\\"] + : _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array + ) { + if (v == null) continue; + _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.push(await InteractionPolicy.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + const _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; + + let _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array = values[\\"https://gotosocial.org/ns#approvedBy\\"]; + + for ( + const v of _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array == null + ? [] + : _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array.length === 1 && \\"@list\\" in _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array[0] + ? _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array[0][\\"@list\\"] + : _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array + ) { + if (v == null) continue; + _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.push(v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + + encodeURIComponent( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(5, v[\\"@id\\"].indexOf(\\"/\\", 5)) + : v[\\"@id\\"].slice(5) + ) + + ( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(v[\\"@id\\"].indexOf(\\"/\\", 5)) + : \\"\\" + ) + ) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + ? new URL(v[\\"@id\\"]) + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])))) + } + instance.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + + const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; + const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + + let _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array = values[\\"https://gotosocial.org/ns#likeAuthorization\\"]; + + for ( + const v of _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array == null + ? [] + : _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array.length === 1 && \\"@list\\" in _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array[0] + ? _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array[0][\\"@list\\"] + : _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push(await LikeAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; + + const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; + const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + + let _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array = values[\\"https://gotosocial.org/ns#replyAuthorization\\"]; + + for ( + const v of _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array == null + ? [] + : _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array.length === 1 && \\"@list\\" in _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array[0] + ? _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array[0][\\"@list\\"] + : _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push(await ReplyAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; + + const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; + const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + + let _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array = values[\\"https://gotosocial.org/ns#announceAuthorization\\"]; + + for ( + const v of _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array == null + ? [] + : _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array.length === 1 && \\"@list\\" in _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array[0] + ? _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array[0][\\"@list\\"] + : _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(await AnnounceAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -10873,223 +12039,5428 @@ get urls(): ((URL | Link))[] { } : v); - if (_5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 1 - || !(\\"tag\\" in proxy) - && _5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 0) { - proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + if (_5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 1 + || !(\\"tag\\" in proxy) + && _5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 0) { + proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + } + + const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length == 1) { + proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + } + + const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) { + proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + } + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 + || !(\\"url\\" in proxy) + && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) { + proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + } + + const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length == 1) { + proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + } + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 1 + || !(\\"to\\" in proxy) + && _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 0) { + proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + } + + const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length == 1) { + proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; + } + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 1 + || !(\\"bto\\" in proxy) + && _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 0) { + proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + } + + const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length == 1) { + proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; + } + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 1 + || !(\\"cc\\" in proxy) + && _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 0) { + proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + } + + const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length == 1) { + proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + } + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 1 + || !(\\"bcc\\" in proxy) + && _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 0) { + proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + } + + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length == 1) { + proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; + } + + const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length == 1) { + proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; + } + + const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length == 1) { + proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + } + + const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length == 1) { + proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + } + + const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length == 1) { + proxy.proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; + } + + if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 1 + || !(\\"proof\\" in proxy) + && _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) { + proxy.proofs = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + } + + const _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length == 1) { + proxy.interactionPolicy = _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[0]; + } + + const _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length == 1) { + proxy.approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[0]; + } + + const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length == 1) { + proxy.likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + } + + const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length == 1) { + proxy.replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + } + + const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length == 1) { + proxy.announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Object.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: Object, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Object \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Object.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: Object, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Object \\" + inspect(proxy, options); + }; + /** Represents a custom emoji. + */ +export class Emoji extends Object { + + /** + * The type URI of {@link Emoji}: \`http://joinmastodon.org/ns#Emoji\`. + */ + static override get typeId(): URL { + return new URL(\\"http://joinmastodon.org/ns#Emoji\\"); + } + + /** + * Constructs a new instance of Emoji with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): Emoji { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Emoji; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + result[\\"type\\"] = \\"Emoji\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + return result; + } + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + values[\\"@type\\"] = [\\"http://joinmastodon.org/ns#Emoji\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__Emoji__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__Emoji__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://joinmastodon.org/ns#Emoji\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof Emoji)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Emoji.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: Emoji, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Emoji \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Emoji.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: Emoji, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Emoji \\" + inspect(proxy, options); + }; + /** \`ChatMessage\`s are the messages sent in 1-on-1 chats. They are similar to + * {@link Note}s, but the addressing is done by having a single AP actor in + * the \`to\` field. Addressing multiple actors is not allowed. These messages + * are always private, there is no public version of them. They are created with + * a {@link Create} activity. + * + */ +export class ChatMessage extends Object { + + /** + * The type URI of {@link ChatMessage}: \`http://litepub.social/ns#ChatMessage\`. + */ + static override get typeId(): URL { + return new URL(\\"http://litepub.social/ns#ChatMessage\\"); + } + #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; + + /** + * Constructs a new instance of ChatMessage with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if (\\"quoteUrl\\" in values && values.quoteUrl != null) { + if (values.quoteUrl instanceof URL) { + // @ts-ignore: type is checked above. + this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; + + } else { + throw new TypeError( + \\"The quoteUrl must be of type \\" + + \\"URL\\" + \\".\\", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): ChatMessage { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + if (\\"quoteUrl\\" in values && values.quoteUrl != null) { + if (values.quoteUrl instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; + + } else { + throw new TypeError( + \\"The quoteUrl must be of type \\" + + \\"URL\\" + \\".\\", + ); + } + } + + return clone; + } + +/** The URI of the ActivityStreams object that this object quotes. + * + * This property sets three JSON-LD properties at once under the hood: + * + * 1. https://www.w3.org/ns/activitystreams#quoteUrl + * 2. https://misskey-hub.net/ns#_misskey_quote + * 3. http://fedibird.com/ns#quoteUri + * + * When a JSON-LD object is parsed, this property is filled with one of + * the values of those three properties in order. + * + */ + get quoteUrl(): (URL | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < 1) return null; + return this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + const item = ( + v.href + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"quoteUrl\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result[\\"_misskey_quote\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result[\\"quoteUri\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result[\\"type\\"] = \\"ChatMessage\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + return result; + } + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + array = []; + for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + const element = ( + { \\"@value\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"] = propValue; + + values[\\"https://misskey-hub.net/ns#_misskey_quote\\"] = propValue; + + values[\\"http://fedibird.com/ns#quoteUri\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"http://litepub.social/ns#ChatMessage\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__ChatMessage__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__ChatMessage__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#ChatMessage\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ChatMessage)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; + + let _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"]; + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://misskey-hub.net/ns#_misskey_quote\\"]; + } + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"http://fedibird.com/ns#quoteUri\\"]; + } + + 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 + ) { + if (v == null) continue; + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v[\\"@value\\"])) + } + instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length == 1) { + proxy.quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(ChatMessage.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: ChatMessage, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ChatMessage \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(ChatMessage.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: ChatMessage, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ChatMessage \\" + inspect(proxy, options); + }; + /** An Activity is a subtype of {@link Object} that describes some form of action + * that may happen, is currently happening, or has already happened. + * The {@link Activity} type itself serves as an abstract base type for all types + * of activities. It is important to note that the {@link Activity} type itself + * does not carry any specific semantics about the kind of action being taken. + * + */ +export class Activity extends Object { + + /** + * The type URI of {@link Activity}: \`https://www.w3.org/ns/activitystreams#Activity\`. + */ + static override get typeId(): URL { + return new URL(\\"https://www.w3.org/ns/activitystreams#Activity\\"); + } + + #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + + #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + + #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + + #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + + #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + + #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + + /** + * Constructs a new instance of Activity with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if (\\"actor\\" in values && values.actor != null) { + if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); + } else { + throw new TypeError( + \\"The actor must be of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + + if (\\"actors\\" in values && values.actors != null) { + + if (\\"actor\\" in values && + values.actor != null) { + throw new TypeError( + \\"Cannot initialize both actor and \\" + + \\"actors at the same time.\\", + ); + } + + if (Array.isArray(values.actors) && + values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; + + for (let i = 0; i < values.actors.length; i++) { + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + } + + } else { + throw new TypeError( + \\"The actors must be an array of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + + if (\\"object\\" in values && values.object != null) { + if (values.object instanceof Object || values.object instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); + } else { + throw new TypeError( + \\"The object must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot initialize both object and \\" + + \\"objects at the same time.\\", + ); + } + + if (Array.isArray(values.objects) && + values.objects.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; + + for (let i = 0; i < values.objects.length; i++) { + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + } + + } else { + throw new TypeError( + \\"The objects must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"target\\" in values && values.target != null) { + if (values.target instanceof Object || values.target instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); + } else { + throw new TypeError( + \\"The target must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"targets\\" in values && values.targets != null) { + + if (\\"target\\" in values && + values.target != null) { + throw new TypeError( + \\"Cannot initialize both target and \\" + + \\"targets at the same time.\\", + ); + } + + if (Array.isArray(values.targets) && + values.targets.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; + + for (let i = 0; i < values.targets.length; i++) { + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + } + + } else { + throw new TypeError( + \\"The targets must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"result\\" in values && values.result != null) { + if (values.result instanceof Object || values.result instanceof URL) { + // @ts-ignore: type is checked above. + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); + } else { + throw new TypeError( + \\"The result must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"results\\" in values && values.results != null) { + + if (\\"result\\" in values && + values.result != null) { + throw new TypeError( + \\"Cannot initialize both result and \\" + + \\"results at the same time.\\", + ); + } + + if (Array.isArray(values.results) && + values.results.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; + + for (let i = 0; i < values.results.length; i++) { + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + } + + } else { + throw new TypeError( + \\"The results must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"origin\\" in values && values.origin != null) { + if (values.origin instanceof Object || values.origin instanceof URL) { + // @ts-ignore: type is checked above. + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); + } else { + throw new TypeError( + \\"The origin must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"origins\\" in values && values.origins != null) { + + if (\\"origin\\" in values && + values.origin != null) { + throw new TypeError( + \\"Cannot initialize both origin and \\" + + \\"origins at the same time.\\", + ); + } + + if (Array.isArray(values.origins) && + values.origins.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; + + for (let i = 0; i < values.origins.length; i++) { + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + } + + } else { + throw new TypeError( + \\"The origins must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"instrument\\" in values && values.instrument != null) { + if (values.instrument instanceof Object || values.instrument instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + } else { + throw new TypeError( + \\"The instrument must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"instruments\\" in values && values.instruments != null) { + + if (\\"instrument\\" in values && + values.instrument != null) { + throw new TypeError( + \\"Cannot initialize both instrument and \\" + + \\"instruments at the same time.\\", + ); + } + + if (Array.isArray(values.instruments) && + values.instruments.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + + for (let i = 0; i < values.instruments.length; i++) { + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + } + + } else { + throw new TypeError( + \\"The instruments must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): Activity { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor;clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); + if (\\"actor\\" in values && values.actor != null) { + if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); + } else { + throw new TypeError( + \\"The actor must be of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + + if (\\"actors\\" in values && values.actors != null) { + + if (\\"actor\\" in values && + values.actor != null) { + throw new TypeError( + \\"Cannot update both actor and \\" + + \\"actors at the same time.\\", + ); + } + + if (Array.isArray(values.actors) && + values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; + + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); + for (let i = 0; i < values.actors.length; i++) { + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + } + + } else { + throw new TypeError( + \\"The actors must be an array of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object;clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + if (\\"object\\" in values && values.object != null) { + if (values.object instanceof Object || values.object instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + } else { + throw new TypeError( + \\"The object must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot update both object and \\" + + \\"objects at the same time.\\", + ); + } + + if (Array.isArray(values.objects) && + values.objects.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; + + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + for (let i = 0; i < values.objects.length; i++) { + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + } + + } else { + throw new TypeError( + \\"The objects must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target;clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); + if (\\"target\\" in values && values.target != null) { + if (values.target instanceof Object || values.target instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); + } else { + throw new TypeError( + \\"The target must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"targets\\" in values && values.targets != null) { + + if (\\"target\\" in values && + values.target != null) { + throw new TypeError( + \\"Cannot update both target and \\" + + \\"targets at the same time.\\", + ); + } + + if (Array.isArray(values.targets) && + values.targets.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; + + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); + for (let i = 0; i < values.targets.length; i++) { + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + } + + } else { + throw new TypeError( + \\"The targets must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result;clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); + if (\\"result\\" in values && values.result != null) { + if (values.result instanceof Object || values.result instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); + } else { + throw new TypeError( + \\"The result must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"results\\" in values && values.results != null) { + + if (\\"result\\" in values && + values.result != null) { + throw new TypeError( + \\"Cannot update both result and \\" + + \\"results at the same time.\\", + ); + } + + if (Array.isArray(values.results) && + values.results.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; + + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); + for (let i = 0; i < values.results.length; i++) { + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + } + + } else { + throw new TypeError( + \\"The results must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin;clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); + if (\\"origin\\" in values && values.origin != null) { + if (values.origin instanceof Object || values.origin instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); + } else { + throw new TypeError( + \\"The origin must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"origins\\" in values && values.origins != null) { + + if (\\"origin\\" in values && + values.origin != null) { + throw new TypeError( + \\"Cannot update both origin and \\" + + \\"origins at the same time.\\", + ); + } + + if (Array.isArray(values.origins) && + values.origins.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; + + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); + for (let i = 0; i < values.origins.length; i++) { + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + } + + } else { + throw new TypeError( + \\"The origins must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument;clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); + if (\\"instrument\\" in values && values.instrument != null) { + if (values.instrument instanceof Object || values.instrument instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); + } else { + throw new TypeError( + \\"The instrument must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"instruments\\" in values && values.instruments != null) { + + if (\\"instrument\\" in values && + values.instrument != null) { + throw new TypeError( + \\"Cannot update both instrument and \\" + + \\"instruments at the same time.\\", + ); + } + + if (Array.isArray(values.instruments) && + values.instruments.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); + for (let i = 0; i < values.instruments.length; i++) { + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + } + + } else { + throw new TypeError( + \\"The instruments must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + return clone; + } + + async #fetchActor( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#actor_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #actor_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getActor}, + * but returns its \`@id\` URL instead of the object itself. + */ + get actorId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; + const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async getActor( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; + let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + if (fetched == null) return null; + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"actor\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"actor\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#actor_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getActors}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get actorIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async* getActors( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"actor\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"actor\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#actor_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#object_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #object_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get objectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity \\"John added a movie to his + * wishlist\\", the object of the activity is the movie added. + * + */ + + async getObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; + let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + if (fetched == null) return null; + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"object\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"object\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#object_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getObjects}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get objectIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity \\"John added a movie to his + * wishlist\\", the object of the activity is the movie added. + * + */ + + async* getObjects( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"object\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"object\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#object_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#target_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #target_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get targetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; + const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the indirect object, or target, of the activity. The precise + * meaning of the target is largely dependent on the type of action being + * described but will often be the object of the English preposition \\"to\\". + * For instance, in the activity \\"John added a movie to his wishlist\\", + * the target of the activity is John's wishlist. An activity can have more + * than one target. + * + */ + + async getTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; + let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchTarget(v, options); + if (fetched == null) return null; + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"target\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"target\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#target_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getTargets}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get targetIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the indirect object, or target, of the activity. The precise + * meaning of the target is largely dependent on the type of action being + * described but will often be the object of the English preposition \\"to\\". + * For instance, in the activity \\"John added a movie to his wishlist\\", + * the target of the activity is John's wishlist. An activity can have more + * than one target. + * + */ + + async* getTargets( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchTarget(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"target\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"target\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#target_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchResult( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#result_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #result_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getResult}, + * but returns its \`@id\` URL instead of the object itself. + */ + get resultId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; + const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the result of the activity. For instance, if a particular action + * results in the creation of a new resource, the result property can be used + * to describe that new resource. + * + */ + + async getResult( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; + let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchResult(v, options); + if (fetched == null) return null; + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"result\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"result\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#result_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getResults}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get resultIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the result of the activity. For instance, if a particular action + * results in the creation of a new resource, the result property can be used + * to describe that new resource. + * + */ + + async* getResults( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchResult(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"result\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"result\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#result_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchOrigin( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#origin_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #origin_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getOrigin}, + * but returns its \`@id\` URL instead of the object itself. + */ + get originId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; + const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes an indirect object of the activity from which the activity is + * directed. The precise meaning of the origin is the object of the English + * preposition \\"from\\". For instance, in the activity \\"John moved an item to + * List B from List A\\", the origin of the activity is \\"List A\\". + * + */ + + async getOrigin( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; + let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchOrigin(v, options); + if (fetched == null) return null; + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"origin\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"origin\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#origin_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getOrigins}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get originIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes an indirect object of the activity from which the activity is + * directed. The precise meaning of the origin is the object of the English + * preposition \\"from\\". For instance, in the activity \\"John moved an item to + * List B from List A\\", the origin of the activity is \\"List A\\". + * + */ + + async* getOrigins( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchOrigin(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"origin\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"origin\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#origin_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchInstrument( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#instrument_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #instrument_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getInstrument}, + * but returns its \`@id\` URL instead of the object itself. + */ + get instrumentId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; + const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more objects used (or to be used) in the completion of + * an {@link Activity}. + * + */ + + async getInstrument( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; + let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInstrument(v, options); + if (fetched == null) return null; + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"instrument\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"instrument\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#instrument_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getInstruments}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get instrumentIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more objects used (or to be used) in the completion of + * an {@link Activity}. + * + */ + + async* getInstruments( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInstrument(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"instrument\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"instrument\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#instrument_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + array = []; + for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#actor\\"] = propValue; + + } + + array = []; + for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#object\\"] = propValue; + + } + + array = []; + for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#target\\"] = propValue; + + } + + array = []; + for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#result\\"] = propValue; + + } + + array = []; + for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#origin\\"] = propValue; + + } + + array = []; + for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#instrument\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Activity\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__Activity__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__Activity__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { + return await EmojiReact.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceRequest\\")) { + return await AnnounceRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeRequest\\")) { + return await LikeRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyRequest\\")) { + return await ReplyRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { + return await Accept.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\")) { + return await TentativeAccept.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Add\\")) { + return await Add.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Announce\\")) { + return await Announce.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Create\\")) { + return await Create.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Delete\\")) { + return await Delete.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Dislike\\")) { + return await Dislike.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Flag\\")) { + return await Flag.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Follow\\")) { + return await Follow.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { + return await Ignore.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { + return await Block.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\")) { + return await IntransitiveActivity.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Arrive\\")) { + return await Arrive.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Question\\")) { + return await Question.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Travel\\")) { + return await Travel.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Join\\")) { + return await Join.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Leave\\")) { + return await Leave.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Like\\")) { + return await Like.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Listen\\")) { + return await Listen.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Move\\")) { + return await Move.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Offer\\")) { + return await Offer.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Invite\\")) { + return await Invite.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Read\\")) { + return await Read.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Reject\\")) { + return await Reject.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeReject\\")) { + return await TentativeReject.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Remove\\")) { + return await Remove.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Undo\\")) { + return await Undo.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Update\\")) { + return await Update.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#View\\")) { + return await View.fromJsonLd(json, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof Activity)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + + let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values[\\"https://www.w3.org/ns/activitystreams#actor\\"]; + + for ( + const v of _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array == null + ? [] + : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array.length === 1 && \\"@list\\" in _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0] + ? _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0][\\"@list\\"] + : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); + + } + instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + + let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; + + for ( + const v of _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array == null + ? [] + : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array.length === 1 && \\"@list\\" in _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0] + ? _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0][\\"@list\\"] + : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + + const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + + let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values[\\"https://www.w3.org/ns/activitystreams#target\\"]; + + for ( + const v of _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array == null + ? [] + : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array.length === 1 && \\"@list\\" in _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0] + ? _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0][\\"@list\\"] + : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + + const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + + let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values[\\"https://www.w3.org/ns/activitystreams#result\\"]; + + for ( + const v of _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array == null + ? [] + : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array.length === 1 && \\"@list\\" in _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0] + ? _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0][\\"@list\\"] + : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + + const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + + let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values[\\"https://www.w3.org/ns/activitystreams#origin\\"]; + + for ( + const v of _25zu2s3VxVujgEKqrDycjE284XQR_origin__array == null + ? [] + : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array.length === 1 && \\"@list\\" in _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0] + ? _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0][\\"@list\\"] + : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + + const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + + let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values[\\"https://www.w3.org/ns/activitystreams#instrument\\"]; + + for ( + const v of _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array == null + ? [] + : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array.length === 1 && \\"@list\\" in _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0] + ? _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0][\\"@list\\"] + : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length == 1) { + proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + } + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 1 + || !(\\"actor\\" in proxy) + && _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 0) { + proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + } + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length == 1) { + proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + } + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 1 + || !(\\"object\\" in proxy) + && _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 0) { + proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + } + + const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length == 1) { + proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + } + + if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 1 + || !(\\"target\\" in proxy) + && _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 0) { + proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + } + + const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length == 1) { + proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + } + + if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 1 + || !(\\"result\\" in proxy) + && _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 0) { + proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + } + + const _25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length == 1) { + proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + } + + if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 1 + || !(\\"origin\\" in proxy) + && _25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 0) { + proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + } + + const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length == 1) { + proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + } + + if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 1 + || !(\\"instrument\\" in proxy) + && _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 0) { + proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Activity.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: Activity, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Activity \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Activity.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: Activity, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Activity \\" + inspect(proxy, options); + }; + /** Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0). + * + */ +export class EmojiReact extends Activity { + + /** + * The type URI of {@link EmojiReact}: \`http://litepub.social/ns#EmojiReact\`. + */ + static override get typeId(): URL { + return new URL(\\"http://litepub.social/ns#EmojiReact\\"); + } + + /** + * Constructs a new instance of EmojiReact with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): EmojiReact { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as EmojiReact; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + values[\\"@type\\"] = [\\"http://litepub.social/ns#EmojiReact\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__EmojiReact__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__EmojiReact__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof EmojiReact)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(EmojiReact.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: EmojiReact, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"EmojiReact \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(EmojiReact.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: EmojiReact, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"EmojiReact \\" + inspect(proxy, options); + }; + /** A pair of property name and value. + */ +export class PropertyValue { + + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. + */ + static get typeId(): URL { + return new URL(\\"http://schema.org#PropertyValue\\"); + } + #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; +#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + + /** + * Constructs a new instance of PropertyValue with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if (\\"\$warning\\" in options) { + this.#warning = options.\$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError(\\"The id must be a URL.\\"); + } + + if (\\"name\\" in values && values.name != null) { + if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + // @ts-ignore: type is checked above. + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; + + } else { + throw new TypeError( + \\"The name must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + + if (\\"value\\" in values && values.value != null) { + if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + // @ts-ignore: type is checked above. + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; + + } else { + throw new TypeError( + \\"The value must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + clone( + values: + { +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): PropertyValue { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: PropertyValue = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + if (\\"name\\" in values && values.name != null) { + if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + // @ts-ignore: type is checked above. + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; + + } else { + throw new TypeError( + \\"The name must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if (\\"value\\" in values && values.value != null) { + if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + // @ts-ignore: type is checked above. + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; + + } else { + throw new TypeError( + \\"The value must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + + return clone; + } + +/** The name of a property. + */ + get name(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) return null; + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + } + +/** The value of a property. + */ + get value(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1) return null; + return this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + const result: Record = {}; + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } - - const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length == 1) { - proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + ); + compactItems.push(item); } + if (compactItems.length > 0) { - const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) { - proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + result[\\"name\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } - if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 - || !(\\"url\\" in proxy) - && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) { - proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + compactItems = []; + for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } - - const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length == 1) { - proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + ); + compactItems.push(item); } + if (compactItems.length > 0) { - if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 1 - || !(\\"to\\" in proxy) - && _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 0) { - proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + result[\\"value\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } - const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + result[\\"type\\"] = \\"PropertyValue\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + return result; + } - if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length == 1) { - proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; - } - - if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 1 - || !(\\"bto\\" in proxy) - && _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 0) { - proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const element = ( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } - - const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#name\\"] = propValue; - if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length == 1) { - proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; - } - - if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 1 - || !(\\"cc\\" in proxy) - && _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 0) { - proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; - } - - const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + } - if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length == 1) { - proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + array = []; + for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + const element = ( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"http://schema.org#value\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"http://schema.org#PropertyValue\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + if ( + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 + ) return false; - if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 1 - || !(\\"bcc\\" in proxy) - && _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 0) { - proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; - } + if ( + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null && + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0 + ) return false; - const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__PropertyValue__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__PropertyValue__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = new this( + { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + options, + ); + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; + + let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values[\\"https://www.w3.org/ns/activitystreams#name\\"]; - if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length == 1) { - proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; - } + for ( + const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null + ? [] + : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && \\"@list\\" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] + ? _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0][\\"@list\\"] + : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array + ) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.push(decoded); - const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + } + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + + let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values[\\"http://schema.org#value\\"]; - if (_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length == 1) { - proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; - } + for ( + const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null + ? [] + : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && \\"@list\\" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] + ? _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0][\\"@list\\"] + : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array + ) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.push(decoded); - const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + } + instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - if (_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length == 1) { - proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); } - - const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -11105,11 +17476,11 @@ get urls(): ((URL | Link))[] { } : v); - if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length == 1) { - proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; } - const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -11125,14 +17496,8 @@ get urls(): ((URL | Link))[] { } : v); - if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length == 1) { - proxy.proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; - } - - if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 1 - || !(\\"proof\\" in proxy) - && _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) { - proxy.proofs = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + if (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { + proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; } return proxy; @@ -11141,40 +17506,55 @@ get urls(): ((URL | Link))[] { // deno-lint-ignore no-explicit-any -(Object.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(PropertyValue.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: Object, + this: PropertyValue, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Object \\" + inspect(proxy, options); + return \\"PropertyValue \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Object.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(PropertyValue.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: Object, + this: PropertyValue, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Object \\" + inspect(proxy, options); + return \\"PropertyValue \\" + inspect(proxy, options); }; - /** Represents a custom emoji. + /** Proves that an {@link Announce} interaction has been approved by + * the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that an announce (boost) was authorized. The \`attributedTo\` property + * identifies the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * */ -export class Emoji extends Object { +export class AnnounceAuthorization extends Object { /** - * The type URI of {@link Emoji}: \`http://joinmastodon.org/ns#Emoji\`. + * The type URI of {@link AnnounceAuthorization}: \`https://gotosocial.org/ns#AnnounceAuthorization\`. */ static override get typeId(): URL { - return new URL(\\"http://joinmastodon.org/ns#Emoji\\"); + return new URL(\\"https://gotosocial.org/ns#AnnounceAuthorization\\"); } + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + /** - * Constructs a new instance of Emoji with the given values. + * Constructs a new instance of AnnounceAuthorization with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -11198,7 +17578,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -11206,7 +17586,33 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, } = {}, ) { - super(values, options);} + super(values, options); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -11234,14 +17640,14 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): Emoji { + ): AnnounceAuthorization { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -11250,10 +17656,467 @@ proofs?: (DataIntegrityProof | URL)[];} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Emoji; + const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + return clone; } + async #fetchInteractingObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactingObject_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactingObject_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link AnnounceAuthorization.getInteractingObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactingObjectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the interaction (e.g., an {@link Announce} activity) that + * has been authorized. + * + */ + + async getInteractingObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactingObject\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactingObject\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + async #fetchInteractionTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactionTarget_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactionTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link AnnounceAuthorization.getInteractionTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactionTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the post that is the target of the authorized announce. + * + */ + + async getInteractionTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractionTarget(v, options); + if (fetched == null) return null; + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactionTarget\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactionTarget\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactionTarget_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -11294,9 +18157,49 @@ proofs?: (DataIntegrityProof | URL)[];} // deno-lint-ignore no-unused-vars let compactItems: unknown[]; - result[\\"type\\"] = \\"Emoji\\"; + compactItems = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactingObject\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactionTarget\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result[\\"type\\"] = \\"AnnounceAuthorization\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -11313,7 +18216,37 @@ proofs?: (DataIntegrityProof | URL)[];} unknown[] | { \\"@list\\": unknown[] } | string >; - values[\\"@type\\"] = [\\"http://joinmastodon.org/ns#Emoji\\"]; + array = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#interactingObject\\"] = propValue; + + } + + array = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#interactionTarget\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#AnnounceAuthorization\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -11322,7 +18255,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -11370,7 +18303,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -11380,7 +18313,7 @@ proofs?: (DataIntegrityProof | URL)[];} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__Emoji__( + const object = await this.__fromJsonLd__AnnounceAuthorization__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -11399,7 +18332,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } - protected static async __fromJsonLd__Emoji__( + protected static async __fromJsonLd__AnnounceAuthorization__( json: unknown, span: Span, options: { @@ -11408,7 +18341,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -11442,7 +18375,7 @@ proofs?: (DataIntegrityProof | URL)[];} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://joinmastodon.org/ns#Emoji\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceAuthorization\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -11453,10 +18386,70 @@ proofs?: (DataIntegrityProof | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof Emoji)) { + if (!(instance instanceof AnnounceAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; + + for ( + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null + ? [] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && \\"@list\\" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0][\\"@list\\"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; + + for ( + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null + ? [] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && \\"@list\\" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0][\\"@list\\"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -11472,52 +18465,97 @@ proofs?: (DataIntegrityProof | URL)[];} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + } + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + } + return proxy; } } // deno-lint-ignore no-explicit-any -(Emoji.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(AnnounceAuthorization.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: Emoji, + this: AnnounceAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Emoji \\" + inspect(proxy, options); + return \\"AnnounceAuthorization \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Emoji.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(AnnounceAuthorization.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: Emoji, + this: AnnounceAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Emoji \\" + inspect(proxy, options); + return \\"AnnounceAuthorization \\" + inspect(proxy, options); }; - /** \`ChatMessage\`s are the messages sent in 1-on-1 chats. They are similar to - * {@link Note}s, but the addressing is done by having a single AP actor in - * the \`to\` field. Addressing multiple actors is not allowed. These messages - * are always private, there is no public version of them. They are created with - * a {@link Create} activity. + /** A request to announce (boost) a post that requires approval from + * the post author. + * + * The \`object\` property references the post to be announced, and + * the \`instrument\` property contains the {@link Announce} activity itself. + * + * The post author responds with an {@link Accept} (with an + * {@link AnnounceAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class ChatMessage extends Object { +export class AnnounceRequest extends Activity { /** - * The type URI of {@link ChatMessage}: \`http://litepub.social/ns#ChatMessage\`. + * The type URI of {@link AnnounceRequest}: \`https://gotosocial.org/ns#AnnounceRequest\`. */ static override get typeId(): URL { - return new URL(\\"http://litepub.social/ns#ChatMessage\\"); + return new URL(\\"https://gotosocial.org/ns#AnnounceRequest\\"); } - #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; - + /** - * Constructs a new instance of ChatMessage with the given values. + * Constructs a new instance of AnnounceRequest with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -11541,7 +18579,13 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} , options: { documentLoader?: DocumentLoader, @@ -11549,20 +18593,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, } = {}, ) { - super(values, options); - if (\\"quoteUrl\\" in values && values.quoteUrl != null) { - if (values.quoteUrl instanceof URL) { - // @ts-ignore: type is checked above. - this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; - - } else { - throw new TypeError( - \\"The quoteUrl must be of type \\" + - \\"URL\\" + \\".\\", - ); - } - } - } + super(values, options);} /** * Clones this instance, optionally updating it with the given values. @@ -11590,14 +18621,20 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): ChatMessage { + ): AnnounceRequest { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -11606,46 +18643,10 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; - if (\\"quoteUrl\\" in values && values.quoteUrl != null) { - if (values.quoteUrl instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; - - } else { - throw new TypeError( - \\"The quoteUrl must be of type \\" + - \\"URL\\" + \\".\\", - ); - } - } - + const clone = super.clone(values, options) as unknown as AnnounceRequest; return clone; } -/** The URI of the ActivityStreams object that this object quotes. - * - * This property sets three JSON-LD properties at once under the hood: - * - * 1. https://www.w3.org/ns/activitystreams#quoteUrl - * 2. https://misskey-hub.net/ns#_misskey_quote - * 3. http://fedibird.com/ns#quoteUri - * - * When a JSON-LD object is parsed, this property is filled with one of - * the values of those three properties in order. - * - */ - get quoteUrl(): (URL | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < 1) return null; - return this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -11675,49 +18676,6 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} contextLoader: options.contextLoader ?? getDocumentLoader(), }; - if (options.format == null && this.isCompactable()) { - - const result = await super.toJsonLd({ - ...options, - format: undefined, - context: undefined, - }) as Record; - - // deno-lint-ignore no-unused-vars - let compactItems: unknown[]; - - compactItems = []; - for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const item = ( - v.href - ); - compactItems.push(item); - } - if (compactItems.length > 0) { - - result[\\"quoteUrl\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result[\\"_misskey_quote\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result[\\"quoteUri\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - } - - result[\\"type\\"] = \\"ChatMessage\\"; - if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; - return result; - } - // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; @@ -11731,26 +18689,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} unknown[] | { \\"@list\\": unknown[] } | string >; - array = []; - for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const element = ( - { \\"@value\\": v.href } - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"] = propValue; - - values[\\"https://misskey-hub.net/ns#_misskey_quote\\"] = propValue; - - values[\\"http://fedibird.com/ns#quoteUri\\"] = propValue; - - } - - values[\\"@type\\"] = [\\"http://litepub.social/ns#ChatMessage\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#AnnounceRequest\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -11759,7 +18698,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -11807,7 +18746,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -11817,7 +18756,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__ChatMessage__( + const object = await this.__fromJsonLd__AnnounceRequest__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -11836,7 +18775,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } - protected static async __fromJsonLd__ChatMessage__( + protected static async __fromJsonLd__AnnounceRequest__( json: unknown, span: Span, options: { @@ -11845,7 +18784,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -11879,7 +18818,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#ChatMessage\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceRequest\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -11890,32 +18829,9 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof ChatMessage)) { + if (!(instance instanceof AnnounceRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } - const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; - - let _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"]; - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://misskey-hub.net/ns#_misskey_quote\\"]; - } - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"http://fedibird.com/ns#quoteUri\\"]; - } - - 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 - ) { - if (v == null) continue; - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v[\\"@value\\"])) - } - instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -11932,363 +18848,161 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); - const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length == 1) { - proxy.quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; - } - return proxy; } } // deno-lint-ignore no-explicit-any -(ChatMessage.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(AnnounceRequest.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: ChatMessage, + this: AnnounceRequest, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"ChatMessage \\" + inspect(proxy, options); + return \\"AnnounceRequest \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(ChatMessage.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(AnnounceRequest.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: ChatMessage, + this: AnnounceRequest, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"ChatMessage \\" + inspect(proxy, options); + return \\"AnnounceRequest \\" + inspect(proxy, options); }; - /** An Activity is a subtype of {@link Object} that describes some form of action - * that may happen, is currently happening, or has already happened. - * The {@link Activity} type itself serves as an abstract base type for all types - * of activities. It is important to note that the {@link Activity} type itself - * does not carry any specific semantics about the kind of action being taken. + /** Represents an interaction policy attached to a post, specifying who can + * like, reply to, or announce it. Each sub-policy ({@link InteractionRule}) + * defines which actors receive automatic or manual approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class Activity extends Object { +export class InteractionPolicy { + + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + /** - * The type URI of {@link Activity}: \`https://www.w3.org/ns/activitystreams#Activity\`. + * The type URI of {@link InteractionPolicy}: \`https://gotosocial.org/ns#InteractionPolicy\`. */ - static override get typeId(): URL { - return new URL(\\"https://www.w3.org/ns/activitystreams#Activity\\"); + static get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#InteractionPolicy\\"); } - - #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); - - #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); - - #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); - - #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); - - #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); - - #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); - - /** - * Constructs a new instance of Activity with the given values. - * @param values The values to initialize the instance with. - * @param options The options to use for initialization. - */ - constructor( - values: - { -id?: URL | null; -attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; -attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; -audiences?: (Object | URL)[];content?: string | LanguageString | null; -contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; -names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; -icons?: (Image | URL)[];image?: Image | URL | null; -images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; -replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; -locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; -previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; -summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; -urls?: ((URL | Link))[];to?: Object | URL | null; -tos?: (Object | URL)[];bto?: Object | URL | null; -btos?: (Object | URL)[];cc?: Object | URL | null; -ccs?: (Object | URL)[];bcc?: Object | URL | null; -bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; -actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; -objects?: (Object | URL)[];target?: Object | URL | null; -targets?: (Object | URL)[];result?: Object | URL | null; -results?: (Object | URL)[];origin?: Object | URL | null; -origins?: (Object | URL)[];instrument?: Object | URL | null; -instruments?: (Object | URL)[];} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } = {}, - ) { - super(values, options); - if (\\"actor\\" in values && values.actor != null) { - if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); - } else { - throw new TypeError( - \\"The actor must be of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - - if (\\"actors\\" in values && values.actors != null) { - - if (\\"actor\\" in values && - values.actor != null) { - throw new TypeError( - \\"Cannot initialize both actor and \\" + - \\"actors at the same time.\\", - ); - } - - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; - - for (let i = 0; i < values.actors.length; i++) { - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } - - } else { - throw new TypeError( - \\"The actors must be an array of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - - if (\\"object\\" in values && values.object != null) { - if (values.object instanceof Object || values.object instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); - } else { - throw new TypeError( - \\"The object must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"objects\\" in values && values.objects != null) { - - if (\\"object\\" in values && - values.object != null) { - throw new TypeError( - \\"Cannot initialize both object and \\" + - \\"objects at the same time.\\", - ); - } - - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; - - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } - - } else { - throw new TypeError( - \\"The objects must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"target\\" in values && values.target != null) { - if (values.target instanceof Object || values.target instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); - } else { - throw new TypeError( - \\"The target must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"targets\\" in values && values.targets != null) { - - if (\\"target\\" in values && - values.target != null) { - throw new TypeError( - \\"Cannot initialize both target and \\" + - \\"targets at the same time.\\", - ); - } - - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; - - for (let i = 0; i < values.targets.length; i++) { - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } - - } else { - throw new TypeError( - \\"The targets must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"result\\" in values && values.result != null) { - if (values.result instanceof Object || values.result instanceof URL) { - // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); - } else { - throw new TypeError( - \\"The result must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"results\\" in values && values.results != null) { - - if (\\"result\\" in values && - values.result != null) { - throw new TypeError( - \\"Cannot initialize both result and \\" + - \\"results at the same time.\\", - ); - } - - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + #_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; +#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply: (InteractionRule)[] = []; +#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce: (InteractionRule)[] = []; + + /** + * Constructs a new instance of InteractionPolicy with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if (\\"\$warning\\" in options) { + this.#warning = options.\$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError(\\"The id must be a URL.\\"); + } + + if (\\"canLike\\" in values && values.canLike != null) { + if (values.canLike instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; - - for (let i = 0; i < values.results.length; i++) { - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } - - } else { - throw new TypeError( - \\"The results must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = [values.canLike]; - if (\\"origin\\" in values && values.origin != null) { - if (values.origin instanceof Object || values.origin instanceof URL) { - // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); } else { throw new TypeError( - \\"The origin must be of type \\" + - \\"Object | URL\\" + \\".\\", + \\"The canLike must be of type \\" + + \\"InteractionRule\\" + \\".\\", ); } } - if (\\"origins\\" in values && values.origins != null) { - - if (\\"origin\\" in values && - values.origin != null) { - throw new TypeError( - \\"Cannot initialize both origin and \\" + - \\"origins at the same time.\\", - ); - } - - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + if (\\"canReply\\" in values && values.canReply != null) { + if (values.canReply instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; - - for (let i = 0; i < values.origins.length; i++) { - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } - - } else { - throw new TypeError( - \\"The origins must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = [values.canReply]; - if (\\"instrument\\" in values && values.instrument != null) { - if (values.instrument instanceof Object || values.instrument instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); } else { throw new TypeError( - \\"The instrument must be of type \\" + - \\"Object | URL\\" + \\".\\", + \\"The canReply must be of type \\" + + \\"InteractionRule\\" + \\".\\", ); } } - if (\\"instruments\\" in values && values.instruments != null) { - - if (\\"instrument\\" in values && - values.instrument != null) { - throw new TypeError( - \\"Cannot initialize both instrument and \\" + - \\"instruments at the same time.\\", - ); - } - - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + if (\\"canAnnounce\\" in values && values.canAnnounce != null) { + if (values.canAnnounce instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = [values.canAnnounce]; - for (let i = 0; i < values.instruments.length; i++) { - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } - } else { throw new TypeError( - \\"The instruments must be an array of type \\" + - \\"Object | URL\\" + \\".\\", + \\"The canAnnounce must be of type \\" + + \\"InteractionRule\\" + \\".\\", ); } } @@ -12300,40 +19014,18 @@ instruments?: (Object | URL)[];} * @param options The options to use for cloning. * @returns The cloned instance. */ - override clone( + clone( values: { id?: URL | null; -attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; -attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; -audiences?: (Object | URL)[];content?: string | LanguageString | null; -contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; -names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; -icons?: (Image | URL)[];image?: Image | URL | null; -images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; -replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; -locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; -previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; -summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; -urls?: ((URL | Link))[];to?: Object | URL | null; -tos?: (Object | URL)[];bto?: Object | URL | null; -btos?: (Object | URL)[];cc?: Object | URL | null; -ccs?: (Object | URL)[];bcc?: Object | URL | null; -bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; -actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; -objects?: (Object | URL)[];target?: Object | URL | null; -targets?: (Object | URL)[];result?: Object | URL | null; -results?: (Object | URL)[];origin?: Object | URL | null; -origins?: (Object | URL)[];instrument?: Object | URL | null; -instruments?: (Object | URL)[];} +canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): Activity { + ): InteractionPolicy { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -12342,1555 +19034,1352 @@ instruments?: (Object | URL)[];} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor;clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); - if (\\"actor\\" in values && values.actor != null) { - if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); - } else { - throw new TypeError( - \\"The actor must be of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - - if (\\"actors\\" in values && values.actors != null) { - - if (\\"actor\\" in values && - values.actor != null) { - throw new TypeError( - \\"Cannot update both actor and \\" + - \\"actors at the same time.\\", - ); - } - - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; - - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); - for (let i = 0; i < values.actors.length; i++) { - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } - - } else { - throw new TypeError( - \\"The actors must be an array of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object;clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); - if (\\"object\\" in values && values.object != null) { - if (values.object instanceof Object || values.object instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); - } else { - throw new TypeError( - \\"The object must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"objects\\" in values && values.objects != null) { - - if (\\"object\\" in values && - values.object != null) { - throw new TypeError( - \\"Cannot update both object and \\" + - \\"objects at the same time.\\", - ); - } - - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; - - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } - - } else { - throw new TypeError( - \\"The objects must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target;clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); - if (\\"target\\" in values && values.target != null) { - if (values.target instanceof Object || values.target instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); - } else { - throw new TypeError( - \\"The target must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"targets\\" in values && values.targets != null) { - - if (\\"target\\" in values && - values.target != null) { - throw new TypeError( - \\"Cannot update both target and \\" + - \\"targets at the same time.\\", - ); - } - - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; - - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); - for (let i = 0; i < values.targets.length; i++) { - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } - - } else { - throw new TypeError( - \\"The targets must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result;clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); - if (\\"result\\" in values && values.result != null) { - if (values.result instanceof Object || values.result instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); - } else { - throw new TypeError( - \\"The result must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"results\\" in values && values.results != null) { - - if (\\"result\\" in values && - values.result != null) { - throw new TypeError( - \\"Cannot update both result and \\" + - \\"results at the same time.\\", - ); - } - - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; - - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); - for (let i = 0; i < values.results.length; i++) { - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } - - } else { - throw new TypeError( - \\"The results must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin;clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); - if (\\"origin\\" in values && values.origin != null) { - if (values.origin instanceof Object || values.origin instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); - } else { - throw new TypeError( - \\"The origin must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"origins\\" in values && values.origins != null) { - - if (\\"origin\\" in values && - values.origin != null) { - throw new TypeError( - \\"Cannot update both origin and \\" + - \\"origins at the same time.\\", - ); - } - - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; - - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); - for (let i = 0; i < values.origins.length; i++) { - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } - - } else { - throw new TypeError( - \\"The origins must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument;clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); - if (\\"instrument\\" in values && values.instrument != null) { - if (values.instrument instanceof Object || values.instrument instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); - } else { - throw new TypeError( - \\"The instrument must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"instruments\\" in values && values.instruments != null) { - - if (\\"instrument\\" in values && - values.instrument != null) { - throw new TypeError( - \\"Cannot update both instrument and \\" + - \\"instruments at the same time.\\", - ); - } - - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; - - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); - for (let i = 0; i < values.instruments.length; i++) { - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } - - } else { - throw new TypeError( - \\"The instruments must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - return clone; - } - async #fetchActor( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } - throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#actor_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); - } - }); - } - - async #actor_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: InteractionPolicy = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + if (\\"canLike\\" in values && values.canLike != null) { + if (values.canLike instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = [values.canLike]; - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; + } else { + throw new TypeError( + \\"The canLike must be of type \\" + + \\"InteractionRule\\" + \\".\\", + ); + } } + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + if (\\"canReply\\" in values && values.canReply != null) { + if (values.canReply instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = [values.canReply]; - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; + } else { + throw new TypeError( + \\"The canReply must be of type \\" + + \\"InteractionRule\\" + \\".\\", + ); + } } + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + if (\\"canAnnounce\\" in values && values.canAnnounce != null) { + if (values.canAnnounce instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = [values.canAnnounce]; - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); - } - - - /** - * Similar to - * {@link Activity.getActor}, - * but returns its \`@id\` URL instead of the object itself. - */ - get actorId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + } else { + throw new TypeError( + \\"The canAnnounce must be of type \\" + + \\"InteractionRule\\" + \\".\\", + ); + } } - if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; - const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - if (v instanceof URL) return v; - return v.id; - } -/** Describes one or more entities that either performed or are expected to - * perform the activity. Any single activity can have multiple actors. - * The actor MAY be specified using an indirect {@link Link}. + return clone; + } + +/** The sub-policy specifying who can like the post. + * + * When absent, implementations should assume that anyone can like the post + * (i.e., \`automaticApproval\` defaults to the public collection). * */ - - async getActor( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { + get canLike(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; - let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) return null; - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"actor\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"actor\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#actor_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; + if (this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length < 1) return null; + return this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[0]; } - /** - * Similar to - * {@link Activity.getActors}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get actorIds(): URL[] { +/** The sub-policy specifying who can reply to the post. + * + * When absent, implementations should assume that anyone can reply + * (i.e., \`automaticApproval\` defaults to the public collection). + * + */ + get canReply(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + if (this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length < 1) return null; + return this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[0]; } -/** Describes one or more entities that either performed or are expected to - * perform the activity. Any single activity can have multiple actors. - * The actor MAY be specified using an indirect {@link Link}. +/** The sub-policy specifying who can announce (boost) the post. + * + * When absent, implementations should assume that anyone can announce + * (i.e., \`automaticApproval\` defaults to the public collection). * */ - - async* getActors( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { + get canAnnounce(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"actor\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"actor\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#actor_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } + if (this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length < 1) return null; + return this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[0]; } - async #fetchObject( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#canLike\\"] = propValue; + + } + + array = []; + for (const v of this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#canReply\\"] = propValue; + + } + + array = []; + for (const v of this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#canAnnounce\\"] = propValue; + + } + + + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + \\"https://gotosocial.org/ns\\"; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + if ( + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike != null && + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length > 0 + ) return false; + + if ( + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply != null && + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length > 0 + ) return false; + + if ( + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce != null && + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length > 0 + ) return false; + + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { try { - fetchResult = await documentLoader(url.href); + const object = await this.__fromJsonLd__InteractionPolicy__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; } catch (error) { span.setStatus({ code: SpanStatusCode.ERROR, message: String(error), }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#object_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; } finally { span.end(); } + }, + ); + } + + protected static async __fromJsonLd__InteractionPolicy__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#InteractionPolicy\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } + } + + const instance = new this( + { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + options, + ); + const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; - async #object_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; + let _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array = values[\\"https://gotosocial.org/ns#canLike\\"]; - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + for ( + const v of _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array == null + ? [] + : _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array.length === 1 && \\"@list\\" in _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array[0] + ? _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array[0][\\"@list\\"] + : _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array + ) { + if (v == null) continue; + _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + const _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply: (InteractionRule)[] = []; + + let _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array = values[\\"https://gotosocial.org/ns#canReply\\"]; + + for ( + const v of _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array == null + ? [] + : _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array.length === 1 && \\"@list\\" in _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array[0] + ? _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array[0][\\"@list\\"] + : _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array + ) { + if (v == null) continue; + _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) } + instance.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + const _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce: (InteractionRule)[] = []; + let _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array = values[\\"https://gotosocial.org/ns#canAnnounce\\"]; - /** - * Similar to - * {@link Activity.getObject}, - * but returns its \`@id\` URL instead of the object itself. - */ - get objectId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; - const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - if (v instanceof URL) return v; - return v.id; + for ( + const v of _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array == null + ? [] + : _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array.length === 1 && \\"@list\\" in _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array[0] + ? _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array[0][\\"@list\\"] + : _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array + ) { + if (v == null) continue; + _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + + const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length == 1) { + proxy.canLike = _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[0]; } -/** When used within an {@link Activity}, describes the direct object of - * the activity. For instance, in the activity \\"John added a movie to his - * wishlist\\", the object of the activity is the movie added. - * - */ - - async getObject( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; - let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) return null; - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"object\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"object\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#object_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; + const _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length == 1) { + proxy.canReply = _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[0]; } - /** - * Similar to - * {@link Activity.getObjects}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get objectIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + const _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length == 1) { + proxy.canAnnounce = _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[0]; } -/** When used within an {@link Activity}, describes the direct object of - * the activity. For instance, in the activity \\"John added a movie to his - * wishlist\\", the object of the activity is the movie added. + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(InteractionPolicy.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: InteractionPolicy, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionPolicy \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(InteractionPolicy.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: InteractionPolicy, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionPolicy \\" + inspect(proxy, options); + }; + /** Represents a sub-policy within an {@link InteractionPolicy}, defining which + * actors receive automatic or manual approval for a specific interaction type + * (like, reply, or announce). + * + * Valid values in the approval lists include: + * + * - The ActivityStreams public collection + * (\`https://www.w3.org/ns/activitystreams#Public\`) for anyone + * - The post author's \`followers\` or \`following\` collection URIs + * - Individual actor URIs + * + * When an actor appears in both \`automaticApproval\` and \`manualApproval\`, + * the more specific value takes precedence (individual URI overrides + * collection membership), and \`automaticApproval\` takes precedence over + * \`manualApproval\` for identical URIs. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ +export class InteractionRule { - async* getObjects( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link InteractionRule}: \`https://gotosocial.org/ns#InteractionRule\`. + */ + static get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#InteractionRule\\"); + } + #_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; +#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval: (URL)[] = []; + + /** + * Constructs a new instance of InteractionRule with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if (\\"\$warning\\" in options) { + this.#warning = options.\$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError(\\"The id must be a URL.\\"); + } + + if (\\"automaticApproval\\" in values && values.automaticApproval != null) { + if (values.automaticApproval instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = [values.automaticApproval]; - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"object\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"object\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#object_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } else { + throw new TypeError( + \\"The automaticApproval must be of type \\" + + \\"URL\\" + \\".\\", ); - continue; } - yield v; } - } - async #fetchTarget( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } - throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#target_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, + if (\\"automaticApprovals\\" in values && values.automaticApprovals != null) { + + if (\\"automaticApproval\\" in values && + values.automaticApproval != null) { + throw new TypeError( + \\"Cannot initialize both automaticApproval and \\" + + \\"automaticApprovals at the same time.\\", ); - return null; } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } + + if (Array.isArray(values.automaticApprovals) && + values.automaticApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals; + + } else { + throw new TypeError( + \\"The automaticApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", ); - return null; } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); - } - }); - } - - async #target_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; } - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); - } - - - /** - * Similar to - * {@link Activity.getTarget}, - * but returns its \`@id\` URL instead of the object itself. - */ - get targetId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if (\\"manualApproval\\" in values && values.manualApproval != null) { + if (values.manualApproval instanceof URL) { + // @ts-ignore: type is checked above. + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = [values.manualApproval]; + + } else { + throw new TypeError( + \\"The manualApproval must be of type \\" + + \\"URL\\" + \\".\\", + ); + } } - if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; - const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - if (v instanceof URL) return v; - return v.id; - } -/** Describes the indirect object, or target, of the activity. The precise - * meaning of the target is largely dependent on the type of action being - * described but will often be the object of the English preposition \\"to\\". - * For instance, in the activity \\"John added a movie to his wishlist\\", - * the target of the activity is John's wishlist. An activity can have more - * than one target. - * - */ - - async getTarget( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if (\\"manualApprovals\\" in values && values.manualApprovals != null) { + + if (\\"manualApproval\\" in values && + values.manualApproval != null) { + throw new TypeError( + \\"Cannot initialize both manualApproval and \\" + + \\"manualApprovals at the same time.\\", + ); + } + + if (Array.isArray(values.manualApprovals) && + values.manualApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals; + + } else { + throw new TypeError( + \\"The manualApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", + ); + } } - if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; - let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - v = v.id; + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + clone( + values: + { +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): InteractionRule { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: InteractionRule = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + if (\\"automaticApproval\\" in values && values.automaticApproval != null) { + if (values.automaticApproval instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = [values.automaticApproval]; + + } else { + throw new TypeError( + \\"The automaticApproval must be of type \\" + + \\"URL\\" + \\".\\", + ); + } } - if (v instanceof URL) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) return null; - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); - this._cachedJsonLd = undefined; - return fetched; + + if (\\"automaticApprovals\\" in values && values.automaticApprovals != null) { + + if (\\"automaticApproval\\" in values && + values.automaticApproval != null) { + throw new TypeError( + \\"Cannot update both automaticApproval and \\" + + \\"automaticApprovals at the same time.\\", + ); + } + + if (Array.isArray(values.automaticApprovals) && + values.automaticApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals; + + } else { + throw new TypeError( + \\"The automaticApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", + ); + } } + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + if (\\"manualApproval\\" in values && values.manualApproval != null) { + if (values.manualApproval instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = [values.manualApproval]; - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"target\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"target\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#target_fromJsonLd(doc, options); + } else { + throw new TypeError( + \\"The manualApproval must be of type \\" + + \\"URL\\" + \\".\\", + ); } } + + if (\\"manualApprovals\\" in values && values.manualApprovals != null) { + + if (\\"manualApproval\\" in values && + values.manualApproval != null) { + throw new TypeError( + \\"Cannot update both manualApproval and \\" + + \\"manualApprovals at the same time.\\", + ); + } - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' + if (Array.isArray(values.manualApprovals) && + values.manualApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals; + + } else { + throw new TypeError( + \\"The manualApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", ); } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; } - return v; - } - /** - * Similar to - * {@link Activity.getTargets}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get targetIds(): URL[] { + return clone; + } + +/** URIs of actors or collections whose interactions are automatically + * approved without requiring manual review by the post author. + * + */ + get automaticApproval(): (URL | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + if (this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < 1) return null; + return this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[0]; } -/** Describes the indirect object, or target, of the activity. The precise - * meaning of the target is largely dependent on the type of action being - * described but will often be the object of the English preposition \\"to\\". - * For instance, in the activity \\"John added a movie to his wishlist\\", - * the target of the activity is John's wishlist. An activity can have more - * than one target. +/** URIs of actors or collections whose interactions are automatically + * approved without requiring manual review by the post author. * */ - - async* getTargets( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { +get automaticApprovals(): (URL)[] { + return this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + } + +/** URIs of actors or collections whose interactions require manual approval + * by the post author. The post author can accept or reject these + * interactions at their discretion. + * + */ + get manualApproval(): (URL | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } + if (this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length < 1) return null; + return this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[0]; + } - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"target\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"target\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#target_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } +/** URIs of actors or collections whose interactions require manual approval + * by the post author. The post author can accept or reject these + * interactions at their discretion. + * + */ +get manualApprovals(): (URL)[] { + return this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; } - async #fetchResult( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + const element = ( + { \\"@id\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#automaticApproval\\"] = propValue; + + } + + array = []; + for (const v of this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + const element = ( + { \\"@id\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#manualApproval\\"] = propValue; + + } + + + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + \\"https://gotosocial.org/ns\\"; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { try { - fetchResult = await documentLoader(url.href); + const object = await this.__fromJsonLd__InteractionRule__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; } catch (error) { span.setStatus({ code: SpanStatusCode.ERROR, message: String(error), }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#result_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; } finally { span.end(); } + }, + ); + } + + protected static async __fromJsonLd__InteractionRule__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#InteractionRule\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = new this( + { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + options, + ); + const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; + + let _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array = values[\\"https://gotosocial.org/ns#automaticApproval\\"]; + + for ( + const v of _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array == null + ? [] + : _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array.length === 1 && \\"@list\\" in _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array[0] + ? _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array[0][\\"@list\\"] + : _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array + ) { + if (v == null) continue; + _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.push(v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + + encodeURIComponent( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(5, v[\\"@id\\"].indexOf(\\"/\\", 5)) + : v[\\"@id\\"].slice(5) + ) + + ( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(v[\\"@id\\"].indexOf(\\"/\\", 5)) + : \\"\\" + ) + ) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + ? new URL(v[\\"@id\\"]) + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])))) } + instance.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + const _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval: (URL)[] = []; - async #result_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL + let _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array = values[\\"https://gotosocial.org/ns#manualApproval\\"]; + + for ( + const v of _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array == null + ? [] + : _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array.length === 1 && \\"@list\\" in _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array[0] + ? _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array[0][\\"@list\\"] + : _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array + ) { + if (v == null) continue; + _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.push(v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + + encodeURIComponent( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(5, v[\\"@id\\"].indexOf(\\"/\\", 5)) + : v[\\"@id\\"].slice(5) + ) + + ( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(v[\\"@id\\"].indexOf(\\"/\\", 5)) + : \\"\\" + ) + ) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + ? new URL(v[\\"@id\\"]) + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])))) + } + instance.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } + const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length == 1) { + proxy.automaticApproval = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[0]; + } - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); - } - + if (_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length > 1 + || !(\\"automaticApproval\\" in proxy) + && _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length > 0) { + proxy.automaticApprovals = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + } + + const _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); - /** - * Similar to - * {@link Activity.getResult}, - * but returns its \`@id\` URL instead of the object itself. - */ - get resultId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; - const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - if (v instanceof URL) return v; - return v.id; + if (_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length == 1) { + proxy.manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[0]; } -/** Describes the result of the activity. For instance, if a particular action - * results in the creation of a new resource, the result property can be used - * to describe that new resource. + if (_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length > 1 + || !(\\"manualApproval\\" in proxy) + && _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length > 0) { + proxy.manualApprovals = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(InteractionRule.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: InteractionRule, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionRule \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(InteractionRule.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: InteractionRule, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionRule \\" + inspect(proxy, options); + }; + /** Proves that a {@link Like} interaction has been approved by the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that a like was authorized. The \`attributedTo\` property identifies + * the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ +export class LikeAuthorization extends Object { - async getResult( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; - let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) return null; - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"result\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"result\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#result_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' + /** + * The type URI of {@link LikeAuthorization}: \`https://gotosocial.org/ns#LikeApproval\`. + */ + static override get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#LikeApproval\\"); + } + + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + /** + * Constructs a new instance of LikeAuthorization with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; } - return v; - } - /** - * Similar to - * {@link Activity.getResults}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get resultIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } } - return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); } - -/** Describes the result of the activity. For instance, if a particular action - * results in the creation of a new resource, the result property can be used - * to describe that new resource. - * - */ - async* getResults( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"result\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"result\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#result_fromJsonLd(obj, options); - } + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): LikeAuthorization { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", ); - continue; } - yield v; } - } - async #fetchOrigin( + return clone; + } + + async #fetchInteractingObject( url: URL, options: { documentLoader?: DocumentLoader, @@ -13932,7 +20421,7 @@ instruments?: (Object | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#origin_fromJsonLd( + const obj = await this.#interactingObject_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -13981,7 +20470,7 @@ instruments?: (Object | URL)[];} }); } - async #origin_fromJsonLd( + async #interactingObject_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -14014,30 +20503,28 @@ instruments?: (Object | URL)[];} /** * Similar to - * {@link Activity.getOrigin}, + * {@link LikeAuthorization.getInteractingObject}, * but returns its \`@id\` URL instead of the object itself. */ - get originId(): URL | null { + get interactingObjectId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; - const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (v instanceof URL) return v; return v.id; } -/** Describes an indirect object of the activity from which the activity is - * directed. The precise meaning of the origin is the object of the English - * preposition \\"from\\". For instance, in the activity \\"John moved an item to - * List B from List A\\", the origin of the activity is \\"List A\\". +/** The URI of the interaction (e.g., a {@link Like} activity) that + * has been authorized. * */ - async getOrigin( + async getInteractingObject( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -14052,161 +20539,63 @@ instruments?: (Object | URL)[];} this._warning.values ); } - if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; - let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { v = v.id; } if (v instanceof URL) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) return null; - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"origin\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"origin\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#origin_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; - } - - /** - * Similar to - * {@link Activity.getOrigins}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get originIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Describes an indirect object of the activity from which the activity is - * directed. The precise meaning of the origin is the object of the English - * preposition \\"from\\". For instance, in the activity \\"John moved an item to - * List B from List A\\", the origin of the activity is \\"List A\\". - * - */ - - async* getOrigins( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; } - const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"origin\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"origin\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#origin_fromJsonLd(obj, options); - } + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactingObject\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactingObject\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); } + } - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' ); - continue; } - yield v; + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; } + return v; } - async #fetchInstrument( + async #fetchInteractionTarget( url: URL, options: { documentLoader?: DocumentLoader, @@ -14248,7 +20637,7 @@ instruments?: (Object | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#instrument_fromJsonLd( + const obj = await this.#interactionTarget_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -14297,7 +20686,7 @@ instruments?: (Object | URL)[];} }); } - async #instrument_fromJsonLd( + async #interactionTarget_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -14330,28 +20719,27 @@ instruments?: (Object | URL)[];} /** * Similar to - * {@link Activity.getInstrument}, + * {@link LikeAuthorization.getInteractionTarget}, * but returns its \`@id\` URL instead of the object itself. */ - get instrumentId(): URL | null { + get interactionTargetId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; - const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (v instanceof URL) return v; return v.id; } -/** Identifies one or more objects used (or to be used) in the completion of - * an {@link Activity}. +/** The URI of the post that is the target of the authorized interaction. * */ - async getInstrument( + async getInteractionTarget( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -14366,19 +20754,19 @@ instruments?: (Object | URL)[];} this._warning.values ); } - if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; - let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchInstrument(v, options); + await this.#fetchInteractionTarget(v, options); if (fetched == null) return null; - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); this._cachedJsonLd = undefined; return fetched; } @@ -14387,19 +20775,19 @@ instruments?: (Object | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"instrument\\" in this._cachedJsonLd + \\"interactionTarget\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"instrument\\"]; + \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#instrument_fromJsonLd(doc, options); + v = await this.#interactionTarget_fromJsonLd(doc, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -14422,102 +20810,6 @@ instruments?: (Object | URL)[];} return v; } - /** - * Similar to - * {@link Activity.getInstruments}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get instrumentIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies one or more objects used (or to be used) in the completion of - * an {@link Activity}. - * - */ - - async* getInstruments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchInstrument(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"instrument\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"instrument\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#instrument_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -14547,6 +20839,63 @@ instruments?: (Object | URL)[];} contextLoader: options.contextLoader ?? getDocumentLoader(), }; + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactingObject\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactionTarget\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result[\\"type\\"] = \\"LikeAuthorization\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; + return result; + } + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; @@ -14561,67 +20910,7 @@ instruments?: (Object | URL)[];} >; array = []; - for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#actor\\"] = propValue; - - } - - array = []; - for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#object\\"] = propValue; - - } - - array = []; - for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#target\\"] = propValue; - - } - - array = []; - for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#result\\"] = propValue; - - } - - array = []; - for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const element = ( v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); @@ -14631,12 +20920,12 @@ instruments?: (Object | URL)[];} const propValue = ( array ); - values[\\"https://www.w3.org/ns/activitystreams#origin\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactingObject\\"] = propValue; } array = []; - for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const element = ( v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); @@ -14646,11 +20935,11 @@ instruments?: (Object | URL)[];} const propValue = ( array ); - values[\\"https://www.w3.org/ns/activitystreams#instrument\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactionTarget\\"] = propValue; } - values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Activity\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#LikeApproval\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -14659,7 +20948,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -14692,214 +20981,94 @@ instruments?: (Object | URL)[];} * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. * @param options The options to use. - * - \`documentLoader\`: The loader for remote JSON-LD documents. - * - \`contextLoader\`: The loader for remote JSON-LD contexts. - * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. - * If omitted, the global tracer provider is used. - * @returns The object of this type. - * @throws {TypeError} If the given \`json\` is invalid. - */ - static override async fromJsonLd( - json: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL, - } = {}, - ): Promise { - const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan( - \\"activitypub.parse_object\\", - async (span) => { - try { - const object = await this.__fromJsonLd__Activity__( - json, span, options); - if (object.id != null) { - span.setAttribute(\\"activitypub.object.id\\", object.id.href); - } - return object; - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - throw error; - } finally { - span.end(); - } - }, - ); - } - - protected static async __fromJsonLd__Activity__( - json: unknown, - span: Span, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL, - } = {}, - ): Promise { - if (typeof json === \\"undefined\\") { - throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); - } - else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); - options = { - ...options, - documentLoader: options.documentLoader ?? getDocumentLoader(), - contextLoader: options.contextLoader ?? getDocumentLoader(), - tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), - }; - // deno-lint-ignore no-explicit-any - let values: Record & { \\"@id\\"?: string }; - if (globalThis.Object.keys(json).length == 0) { - values = {}; - } else { - const expanded = await jsonld.expand(json, { - documentLoader: options.contextLoader, - keepFreeFloatingNodes: true, - }); - values = - // deno-lint-ignore no-explicit-any - (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); - } - if (options.baseUrl == null && values[\\"@id\\"] != null) { - options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; - } - - if (\\"@type\\" in values) { - span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); - } - if (\\"@type\\" in values && - !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - - if (values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { - return await EmojiReact.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { - return await Accept.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\")) { - return await TentativeAccept.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Add\\")) { - return await Add.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Announce\\")) { - return await Announce.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Create\\")) { - return await Create.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Delete\\")) { - return await Delete.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Dislike\\")) { - return await Dislike.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Flag\\")) { - return await Flag.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Follow\\")) { - return await Follow.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { - return await Ignore.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { - return await Block.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\")) { - return await IntransitiveActivity.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Arrive\\")) { - return await Arrive.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Question\\")) { - return await Question.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Travel\\")) { - return await Travel.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Join\\")) { - return await Join.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Leave\\")) { - return await Leave.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Like\\")) { - return await Like.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Listen\\")) { - return await Listen.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Move\\")) { - return await Move.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Offer\\")) { - return await Offer.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Invite\\")) { - return await Invite.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Read\\")) { - return await Read.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Reject\\")) { - return await Reject.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeReject\\")) { - return await TentativeReject.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Remove\\")) { - return await Remove.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Undo\\")) { - return await Undo.fromJsonLd(json, options); + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__LikeAuthorization__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__LikeAuthorization__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Update\\")) { - return await Update.fromJsonLd(json, options); + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#View\\")) { - return await View.fromJsonLd(json, options); + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } - - if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeApproval\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -14910,212 +21079,69 @@ instruments?: (Object | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof Activity)) { + if (!(instance instanceof LikeAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); - - let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values[\\"https://www.w3.org/ns/activitystreams#actor\\"]; - - for ( - const v of _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array == null - ? [] - : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array.length === 1 && \\"@list\\" in _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0] - ? _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0][\\"@list\\"] - : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - - const decoded = - typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : undefined - ; - if (typeof decoded === \\"undefined\\") continue; - _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); - - } - instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - - const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); - - let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; - - for ( - const v of _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array == null - ? [] - : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array.length === 1 && \\"@list\\" in _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0] - ? _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0][\\"@list\\"] - : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - )) - } - instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - - const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); - - let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values[\\"https://www.w3.org/ns/activitystreams#target\\"]; - - for ( - const v of _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array == null - ? [] - : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array.length === 1 && \\"@list\\" in _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0] - ? _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0][\\"@list\\"] - : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - )) - } - instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - - const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); - - let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values[\\"https://www.w3.org/ns/activitystreams#result\\"]; - - for ( - const v of _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array == null - ? [] - : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array.length === 1 && \\"@list\\" in _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0] - ? _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0][\\"@list\\"] - : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - )) - } - instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - - const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); - let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values[\\"https://www.w3.org/ns/activitystreams#origin\\"]; + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; for ( - const v of _25zu2s3VxVujgEKqrDycjE284XQR_origin__array == null + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] - : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array.length === 1 && \\"@list\\" in _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0] - ? _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0][\\"@list\\"] - : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && \\"@list\\" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0][\\"@list\\"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array ) { if (v == null) continue; if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) : new URL(v[\\"@id\\"]) ); continue; } - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } )) } - instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; - const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); - let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values[\\"https://www.w3.org/ns/activitystreams#instrument\\"]; + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; for ( - const v of _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array == null + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] - : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array.length === 1 && \\"@list\\" in _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0] - ? _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0][\\"@list\\"] - : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && \\"@list\\" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0][\\"@list\\"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array ) { if (v == null) continue; if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) : new URL(v[\\"@id\\"]) ); continue; } - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } )) } - instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -15132,111 +21158,7 @@ instruments?: (Object | URL)[];} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length == 1) { - proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - } - - if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 1 - || !(\\"actor\\" in proxy) - && _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 0) { - proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - } - - const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length == 1) { - proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - } - - if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 1 - || !(\\"object\\" in proxy) - && _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 0) { - proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - } - - const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length == 1) { - proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - } - - if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 1 - || !(\\"target\\" in proxy) - && _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 0) { - proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - } - - const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length == 1) { - proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - } - - if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 1 - || !(\\"result\\" in proxy) - && _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 0) { - proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - } - - const _25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -15252,17 +21174,11 @@ instruments?: (Object | URL)[];} } : v); - if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length == 1) { - proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; - } - - if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 1 - || !(\\"origin\\" in proxy) - && _25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 0) { - proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; } - const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -15278,14 +21194,8 @@ instruments?: (Object | URL)[];} } : v); - if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length == 1) { - proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; - } - - if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 1 - || !(\\"instrument\\" in proxy) - && _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 0) { - proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; } return proxy; @@ -15294,41 +21204,50 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any -(Activity.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(LikeAuthorization.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: Activity, + this: LikeAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Activity \\" + inspect(proxy, options); + return \\"LikeAuthorization \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Activity.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(LikeAuthorization.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: Activity, + this: LikeAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Activity \\" + inspect(proxy, options); + return \\"LikeAuthorization \\" + inspect(proxy, options); }; - /** Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0). + /** A request to like a post that requires approval from the post author. + * + * The \`object\` property references the post to be liked, and + * the \`instrument\` property contains the {@link Like} activity itself. + * + * The post author responds with an {@link Accept} (with a + * {@link LikeAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class EmojiReact extends Activity { +export class LikeRequest extends Activity { /** - * The type URI of {@link EmojiReact}: \`http://litepub.social/ns#EmojiReact\`. + * The type URI of {@link LikeRequest}: \`https://gotosocial.org/ns#LikeRequest\`. */ static override get typeId(): URL { - return new URL(\\"http://litepub.social/ns#EmojiReact\\"); + return new URL(\\"https://gotosocial.org/ns#LikeRequest\\"); } /** - * Constructs a new instance of EmojiReact with the given values. + * Constructs a new instance of LikeRequest with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -15352,7 +21271,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -15394,7 +21313,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -15407,7 +21326,7 @@ instruments?: (Object | URL)[];} documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): EmojiReact { + ): LikeRequest { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -15416,7 +21335,7 @@ instruments?: (Object | URL)[];} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as EmojiReact; + const clone = super.clone(values, options) as unknown as LikeRequest; return clone; } @@ -15462,7 +21381,7 @@ instruments?: (Object | URL)[];} unknown[] | { \\"@list\\": unknown[] } | string >; - values[\\"@type\\"] = [\\"http://litepub.social/ns#EmojiReact\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#LikeRequest\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -15471,7 +21390,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -15519,7 +21438,7 @@ instruments?: (Object | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -15529,7 +21448,7 @@ instruments?: (Object | URL)[];} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__EmojiReact__( + const object = await this.__fromJsonLd__LikeRequest__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -15548,7 +21467,7 @@ instruments?: (Object | URL)[];} ); } - protected static async __fromJsonLd__EmojiReact__( + protected static async __fromJsonLd__LikeRequest__( json: unknown, span: Span, options: { @@ -15557,7 +21476,7 @@ instruments?: (Object | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -15591,7 +21510,7 @@ instruments?: (Object | URL)[];} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeRequest\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -15602,7 +21521,7 @@ instruments?: (Object | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof EmojiReact)) { + if (!(instance instanceof LikeRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } @@ -15627,81 +21546,54 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any -(EmojiReact.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(LikeRequest.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: EmojiReact, + this: LikeRequest, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"EmojiReact \\" + inspect(proxy, options); + return \\"LikeRequest \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(EmojiReact.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(LikeRequest.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: EmojiReact, + this: LikeRequest, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"EmojiReact \\" + inspect(proxy, options); + return \\"LikeRequest \\" + inspect(proxy, options); }; - /** A pair of property name and value. + /** Proves that a reply interaction has been approved by the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that a reply was authorized. The \`attributedTo\` property identifies + * the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * */ -export class PropertyValue { - - readonly #documentLoader?: DocumentLoader; - readonly #contextLoader?: DocumentLoader; - readonly #tracerProvider?: TracerProvider; - readonly #warning?: { - category: string[]; - message: string; - values?: Record; - }; - #cachedJsonLd?: unknown; - readonly id: URL | null; - - protected get _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } - - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } - - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } - - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } - - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } +export class ReplyAuthorization extends Object { - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - /** - * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. + * The type URI of {@link ReplyAuthorization}: \`https://gotosocial.org/ns#ReplyAuthorization\`. */ - static get typeId(): URL { - return new URL(\\"http://schema.org#PropertyValue\\"); + static override get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#ReplyAuthorization\\"); } - #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; -#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; - + + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + /** - * Constructs a new instance of PropertyValue with the given values. + * Constructs a new instance of ReplyAuthorization with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -15709,7 +21601,23 @@ export class PropertyValue { values: { id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -15717,45 +21625,29 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, } = {}, ) { - - this.#documentLoader = options.documentLoader; - this.#contextLoader = options.contextLoader; - this.#tracerProvider = options.tracerProvider; - if (\\"\$warning\\" in options) { - this.#warning = options.\$warning as unknown as { - category: string[]; - message: string; - values?: Record; - }; - } - if (values.id == null || values.id instanceof URL) { - this.id = values.id ?? null; - } else { - throw new TypeError(\\"The id must be a URL.\\"); - } - - if (\\"name\\" in values && values.name != null) { - if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + super(values, options); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; - + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); } else { throw new TypeError( - \\"The name must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } - if (\\"value\\" in values && values.value != null) { - if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; - + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); } else { throw new TypeError( - \\"The value must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } @@ -15767,18 +21659,34 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @param options The options to use for cloning. * @returns The cloned instance. */ - clone( + override clone( values: { id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): PropertyValue { + ): ReplyAuthorization { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -15787,35 +21695,29 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - - // @ts-ignore: this.constructor is not recognized as a constructor, but it is. - const clone: PropertyValue = new this.constructor( - { id: values.id ?? this.id }, - options - ); - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - if (\\"name\\" in values && values.name != null) { - if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; - + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); } else { throw new TypeError( - \\"The name must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - if (\\"value\\" in values && values.value != null) { - if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; - + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); } else { throw new TypeError( - \\"The value must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } @@ -15823,30 +21725,435 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return clone; } -/** The name of a property. + async #fetchInteractingObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactingObject_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactingObject_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link ReplyAuthorization.getInteractingObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactingObjectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the reply object (e.g., a {@link Note}) that has been + * authorized. + * */ - get name(): (string | LanguageString | null) { + + async getInteractingObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) return null; - return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactingObject\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactingObject\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } -/** The value of a property. + async #fetchInteractionTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactionTarget_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactionTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link ReplyAuthorization.getInteractionTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactionTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the post that is the target of the authorized reply. + * */ - get value(): (string | LanguageString | null) { + + async getInteractionTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1) return null; - return this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractionTarget(v, options); + if (fetched == null) return null; + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactionTarget\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactionTarget\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactionTarget_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } /** @@ -15859,7 +22166,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} when \`format\` is set to \`'expand'\`. * @returns The JSON-LD representation of this object. */ - async toJsonLd(options: { + override async toJsonLd(options: { format?: \\"compact\\" | \\"expand\\", contextLoader?: DocumentLoader, context?: string | Record | (string | Record)[], @@ -15879,23 +22186,30 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} }; if (options.format == null && this.isCompactable()) { - const result: Record = {}; + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + // deno-lint-ignore no-unused-vars let compactItems: unknown[]; compactItems = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) ); compactItems.push(item); } if (compactItems.length > 0) { - result[\\"name\\"] + result[\\"interactingObject\\"] = compactItems.length > 1 ? compactItems : compactItems[0]; @@ -15903,40 +22217,48 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } compactItems = []; - for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) ); compactItems.push(item); } if (compactItems.length > 0) { - result[\\"value\\"] + result[\\"interactionTarget\\"] = compactItems.length > 1 ? compactItems : compactItems[0]; } - result[\\"type\\"] = \\"PropertyValue\\"; + result[\\"type\\"] = \\"ReplyAuthorization\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + array = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const element = ( - typeof v === \\"string\\" ? { \\"@value\\": v } : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); array.push(element);; } @@ -15944,17 +22266,14 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const propValue = ( array ); - values[\\"https://www.w3.org/ns/activitystreams#name\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactingObject\\"] = propValue; } array = []; - for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const element = ( - typeof v === \\"string\\" ? { \\"@value\\": v } : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); array.push(element);; } @@ -15962,11 +22281,11 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const propValue = ( array ); - values[\\"http://schema.org#value\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactionTarget\\"] = propValue; } - values[\\"@type\\"] = [\\"http://schema.org#PropertyValue\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#ReplyAuthorization\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -15975,7 +22294,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -15984,23 +22303,24 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} if (docContext != null) { // Embed context + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + } return compacted; } - protected isCompactable(): boolean { + protected override isCompactable(): boolean { - if ( - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 - ) return false; - - if ( - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null && - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0 - ) return false; - - return true; + return super.isCompactable(); } /** @@ -16014,7 +22334,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @returns The object of this type. * @throws {TypeError} If the given \`json\` is invalid. */ - static async fromJsonLd( + static override async fromJsonLd( json: unknown, options: { documentLoader?: DocumentLoader, @@ -16022,7 +22342,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -16032,7 +22352,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__PropertyValue__( + const object = await this.__fromJsonLd__ReplyAuthorization__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -16051,7 +22371,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } - protected static async __fromJsonLd__PropertyValue__( + protected static async __fromJsonLd__ReplyAuthorization__( json: unknown, span: Span, options: { @@ -16060,7 +22380,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -16094,63 +22414,80 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyAuthorization\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } - const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, - options, - ); - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; - - let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values[\\"https://www.w3.org/ns/activitystreams#name\\"]; + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ReplyAuthorization)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; for ( - const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && \\"@list\\" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] - ? _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0][\\"@list\\"] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && \\"@list\\" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0][\\"@list\\"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array ) { if (v == null) continue; - const decoded = - typeof v === \\"object\\" && \\"@value\\" in v - && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v - && typeof v[\\"@language\\"] === \\"string\\" - && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined - ; - if (typeof decoded === \\"undefined\\") continue; - _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.push(decoded); - + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) } - instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; - - let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values[\\"http://schema.org#value\\"]; + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; for ( - const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && \\"@list\\" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] - ? _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0][\\"@list\\"] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && \\"@list\\" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0][\\"@list\\"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array ) { if (v == null) continue; - const decoded = - typeof v === \\"object\\" && \\"@value\\" in v - && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v - && typeof v[\\"@language\\"] === \\"string\\" - && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined - ; - if (typeof decoded === \\"undefined\\") continue; - _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.push(decoded); - + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) } - instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -16165,24 +22502,9 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return instance; } - protected _getCustomInspectProxy(): Record { - - const proxy: Record = {}; - if (this.id != null) { - proxy.id = { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(this.id!.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(this.id!.href, options), - }; - } - - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -16198,11 +22520,11 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } : v); - if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { - proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; } - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -16218,8 +22540,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } : v); - if (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { - proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; } return proxy; @@ -16228,26 +22550,368 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any -(PropertyValue.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(ReplyAuthorization.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: PropertyValue, + this: ReplyAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"PropertyValue \\" + inspect(proxy, options); + return \\"ReplyAuthorization \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(PropertyValue.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(ReplyAuthorization.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: PropertyValue, + this: ReplyAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"PropertyValue \\" + inspect(proxy, options); + return \\"ReplyAuthorization \\" + inspect(proxy, options); + }; + /** A request to reply to a post that requires approval from the post author. + * + * The \`object\` property references the post to be replied to, and + * the \`instrument\` property contains the reply itself (e.g., a {@link Note}). + * + * The post author responds with an {@link Accept} (with a + * {@link ReplyAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * + */ +export class ReplyRequest extends Activity { + + /** + * The type URI of {@link ReplyRequest}: \`https://gotosocial.org/ns#ReplyRequest\`. + */ + static override get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#ReplyRequest\\"); + } + + /** + * Constructs a new instance of ReplyRequest with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): ReplyRequest { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as ReplyRequest; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#ReplyRequest\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__ReplyRequest__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__ReplyRequest__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyRequest\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ReplyRequest)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(ReplyRequest.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: ReplyRequest, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ReplyRequest \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(ReplyRequest.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: ReplyRequest, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ReplyRequest \\" + inspect(proxy, options); }; /** Means of communicating or interacting with the DID subject or associated * entities via one or more service endpoints. Examples include discovery @@ -19844,7 +26508,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -19886,7 +26550,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -19963,7 +26627,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -20184,7 +26848,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20226,7 +26890,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20303,7 +26967,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -20519,7 +27183,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20561,7 +27225,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20638,7 +27302,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -20899,7 +27563,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -21363,7 +28027,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -25782,7 +32446,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Application\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -26141,7 +32805,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -27444,7 +34108,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27486,7 +34150,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27563,7 +34227,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -27791,7 +34455,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27833,7 +34497,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27910,7 +34574,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -28124,7 +34788,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} , options: { documentLoader?: DocumentLoader, @@ -28173,7 +34837,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} = {}, options: { @@ -28297,7 +34961,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} result[\\"type\\"] = \\"Article\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -28342,7 +35006,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -28600,7 +35264,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -28662,7 +35326,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -28812,7 +35476,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Document\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -28874,7 +35538,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -29173,7 +35837,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -29209,7 +35873,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -29271,7 +35935,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Audio\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -29297,7 +35961,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -29512,7 +36176,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29554,7 +36218,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29631,7 +36295,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -29852,7 +36516,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29894,7 +36558,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29971,7 +36635,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -30226,7 +36890,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -30437,7 +37101,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} = {}, options: { @@ -33546,7 +40210,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"Collection\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -33770,7 +40434,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -34048,7 +40712,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -34657,7 +41321,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -34732,7 +41396,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} = {}, options: { @@ -35538,7 +42202,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"CollectionPage\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -35609,7 +42273,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -35976,7 +42640,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36018,7 +42682,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36095,7 +42759,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -36310,7 +42974,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36352,7 +43016,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36429,7 +43093,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -36642,7 +43306,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36684,7 +43348,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36761,7 +43425,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -38078,7 +44742,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -38114,7 +44778,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} = {}, options: { @@ -38176,7 +44840,7 @@ proofs?: (DataIntegrityProof | URL)[];} result[\\"type\\"] = \\"Event\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -38202,7 +44866,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -38418,7 +45082,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38460,7 +45124,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38537,7 +45201,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -38754,7 +45418,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38796,7 +45460,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38873,7 +45537,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -39134,7 +45798,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -39598,7 +46262,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -44017,7 +50681,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Group\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -44376,7 +51040,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -47062,7 +53726,7 @@ get names(): ((string | LanguageString))[] { v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -47642,7 +54306,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -47678,7 +54342,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -47740,7 +54404,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Image\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = \\"https://www.w3.org/ns/activitystreams\\"; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -47766,7 +54430,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - \\"https://www.w3.org/ns/activitystreams\\"; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -47982,7 +54646,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48024,7 +54688,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48101,7 +54765,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -48320,7 +54984,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48362,7 +55026,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48439,7 +55103,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -48654,7 +55318,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48696,7 +55360,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48773,7 +55437,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -48988,7 +55652,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49030,7 +55694,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49107,7 +55771,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -49322,7 +55986,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49364,7 +56028,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49441,7 +56105,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -49654,7 +56318,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49696,7 +56360,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49773,7 +56437,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -50287,7 +56951,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -50329,7 +56993,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -50406,7 +57070,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -50622,7 +57286,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} , options: { documentLoader?: DocumentLoader, @@ -50671,7 +57335,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} = {}, options: { @@ -50795,7 +57459,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} result[\\"type\\"] = \\"Note\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -50840,7 +57504,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -51101,7 +57765,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} , options: { documentLoader?: DocumentLoader, @@ -51156,7 +57820,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} = {}, options: { @@ -51486,7 +58150,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"OrderedCollection\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -51527,7 +58191,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -51688,7 +58352,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -51812,7 +58476,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -51880,7 +58544,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} = {}, options: { @@ -52254,7 +58918,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"OrderedCollectionPage\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -52313,7 +58977,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -52474,7 +59138,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -52674,7 +59338,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -53138,7 +59802,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -57557,7 +64221,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Organization\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -57916,7 +64580,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -59216,7 +65880,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -59252,7 +65916,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -59314,7 +65978,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Page\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -59340,7 +66004,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -59601,7 +66265,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -60065,7 +66729,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -64484,7 +71148,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Person\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -64843,7 +71507,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -66152,7 +72816,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -66266,7 +72930,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} = {}, options: { @@ -66592,7 +73256,7 @@ proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number result[\\"type\\"] = \\"Place\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -66723,7 +73387,7 @@ proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -67178,7 +73842,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;describes?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -67227,7 +73891,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;describes?: Object | URL | null;} = {}, options: { @@ -67538,7 +74202,7 @@ proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} result[\\"type\\"] = \\"Profile\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -67579,7 +74243,7 @@ proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -67859,7 +74523,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -67978,7 +74642,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -68710,7 +75374,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -69157,7 +75821,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69199,7 +75863,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69276,7 +75940,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -69491,7 +76155,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69533,7 +76197,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69610,7 +76274,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -69843,7 +76507,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];subject?: Object | URL | null;object?: Object | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;subject?: Object | URL | null;object?: Object | URL | null; objects?: (Object | URL)[];relationship?: Object | URL | null; relationships?: (Object | URL)[];} , @@ -69974,7 +76638,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];subject?: Object | URL | null;object?: Object | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;subject?: Object | URL | null;object?: Object | URL | null; objects?: (Object | URL)[];relationship?: Object | URL | null; relationships?: (Object | URL)[];} @@ -71035,7 +77699,7 @@ relationships?: (Object | URL)[];} result[\\"type\\"] = \\"Relationship\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -71106,7 +77770,7 @@ relationships?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -71483,7 +78147,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -71525,7 +78189,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -71602,7 +78266,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -71863,7 +78527,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -72327,7 +78991,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -76746,7 +83410,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Service\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -77105,7 +83769,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -79048,7 +85712,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79090,7 +85754,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79167,7 +85831,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -79382,7 +86046,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79424,7 +86088,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79501,7 +86165,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -79718,7 +86382,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;deleted?: Temporal.Instant | null;} , options: { documentLoader?: DocumentLoader, @@ -79767,7 +86431,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;deleted?: Temporal.Instant | null;} = {}, options: { @@ -79873,7 +86537,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} result[\\"type\\"] = \\"Tombstone\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -79917,7 +86581,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -80173,7 +86837,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80215,7 +86879,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80292,7 +86956,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -80512,7 +87176,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80554,7 +87218,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80631,7 +87295,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -80849,7 +87513,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80891,7 +87555,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80968,7 +87632,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"sensitive\\":\\"as:sensitive\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"quoteUrl\\":\\"as:quoteUrl\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"sensitive\\":\\"as:sensitive\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"quoteUrl\\":\\"as:quoteUrl\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -81181,7 +87845,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -81217,7 +87881,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -81279,7 +87943,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Video\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -81305,7 +87969,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -81519,7 +88183,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -81561,7 +88225,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -81638,7 +88302,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap index e62d1a160..a429a2385 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap @@ -145,6 +145,17 @@ export class Object { #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + #_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; +#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; + + #_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; + #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + + #_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; + #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + + #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; + #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); /** * Constructs a new instance of Object with the given values. @@ -171,7 +182,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -1051,6 +1062,71 @@ proofs?: (DataIntegrityProof | URL)[];} ); } } + + if (\\"interactionPolicy\\" in values && values.interactionPolicy != null) { + if (values.interactionPolicy instanceof InteractionPolicy) { + // @ts-ignore: type is checked above. + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = [values.interactionPolicy]; + + } else { + throw new TypeError( + \\"The interactionPolicy must be of type \\" + + \\"InteractionPolicy\\" + \\".\\", + ); + } + } + + if (\\"approvedBy\\" in values && values.approvedBy != null) { + if (values.approvedBy instanceof URL) { + // @ts-ignore: type is checked above. + this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = [values.approvedBy]; + + } else { + throw new TypeError( + \\"The approvedBy must be of type \\" + + \\"URL\\" + \\".\\", + ); + } + } + + if (\\"likeAuthorization\\" in values && values.likeAuthorization != null) { + if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.add(0); + } else { + throw new TypeError( + \\"The likeAuthorization must be of type \\" + + \\"LikeAuthorization | URL\\" + \\".\\", + ); + } + } + + if (\\"replyAuthorization\\" in values && values.replyAuthorization != null) { + if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.add(0); + } else { + throw new TypeError( + \\"The replyAuthorization must be of type \\" + + \\"ReplyAuthorization | URL\\" + \\".\\", + ); + } + } + + if (\\"announceAuthorization\\" in values && values.announceAuthorization != null) { + if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0); + } else { + throw new TypeError( + \\"The announceAuthorization must be of type \\" + + \\"AnnounceAuthorization | URL\\" + \\".\\", + ); + } + } } /** @@ -1079,7 +1155,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} = {}, options: { @@ -1973,248 +2049,76 @@ proofs?: (DataIntegrityProof | URL)[];} ); } } + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + if (\\"interactionPolicy\\" in values && values.interactionPolicy != null) { + if (values.interactionPolicy instanceof InteractionPolicy) { + // @ts-ignore: type is checked above. + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = [values.interactionPolicy]; - return clone; - } - - async #fetchAttachment( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } + } else { + throw new TypeError( + \\"The interactionPolicy must be of type \\" + + \\"InteractionPolicy\\" + \\".\\", ); - return null; } - throw error; } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#attachment_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + if (\\"approvedBy\\" in values && values.approvedBy != null) { + if (values.approvedBy instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = [values.approvedBy]; + + } else { + throw new TypeError( + \\"The approvedBy must be of type \\" + + \\"URL\\" + \\".\\", ); - return null; } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } + } + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization;clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization); + if (\\"likeAuthorization\\" in values && values.likeAuthorization != null) { + if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set([0]); + } else { + throw new TypeError( + \\"The likeAuthorization must be of type \\" + + \\"LikeAuthorization | URL\\" + \\".\\", ); - return null; } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); } - }); - } - - async #attachment_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await PropertyValue.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\",\\"http://schema.org#PropertyValue\\"].join(\\", \\")); - } - - - /** - * Similar to - * {@link Object.getAttachments}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get attachmentIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies a resource attached or related to an object that potentially - * requires special handling. The intent is to provide a model that is at - * least semantically similar to attachments in email. - * - */ - - async* getAttachments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchAttachment(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"attachment\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"attachment\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attachment_fromJsonLd(obj, options); - } + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization;clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization); + if (\\"replyAuthorization\\" in values && values.replyAuthorization != null) { + if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set([0]); + } else { + throw new TypeError( + \\"The replyAuthorization must be of type \\" + + \\"ReplyAuthorization | URL\\" + \\".\\", + ); } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization;clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization); + if (\\"announceAuthorization\\" in values && values.announceAuthorization != null) { + if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set([0]); + } else { + throw new TypeError( + \\"The announceAuthorization must be of type \\" + + \\"AnnounceAuthorization | URL\\" + \\".\\", ); - continue; } - yield v; } - } - async #fetchAttribution( + return clone; + } + + async #fetchAttachment( url: URL, options: { documentLoader?: DocumentLoader, @@ -2223,7 +2127,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2256,7 +2160,7 @@ proofs?: (DataIntegrityProof | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#attribution_fromJsonLd( + const obj = await this.#attachment_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -2305,7 +2209,7 @@ proofs?: (DataIntegrityProof | URL)[];} }); } - async #attribution_fromJsonLd( + async #attachment_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -2313,7 +2217,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL } - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2323,25 +2227,7 @@ proofs?: (DataIntegrityProof | URL)[];} const baseUrl = options.baseUrl; try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( + return await Object.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2350,7 +2236,7 @@ proofs?: (DataIntegrityProof | URL)[];} } try { - return await Person.fromJsonLd( + return await Link.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2359,7 +2245,7 @@ proofs?: (DataIntegrityProof | URL)[];} } try { - return await Service.fromJsonLd( + return await PropertyValue.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2368,129 +2254,34 @@ proofs?: (DataIntegrityProof | URL)[];} } throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); + [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"https://www.w3.org/ns/activitystreams#Link\\",\\"http://schema.org#PropertyValue\\"].join(\\", \\")); } /** * Similar to - * {@link Object.getAttribution}, - * but returns its \`@id\` URL instead of the object itself. - */ - get attributionId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; - const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies one or more entities to which this object is attributed. - * The attributed entities might not be Actors. For instance, - * an object might be attributed to the completion of another activity. - * - */ - - async getAttribution( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; - let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchAttribution(v, options); - if (fetched == null) return null; - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"attributedTo\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"attributedTo\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#attribution_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; - } - - /** - * Similar to - * {@link Object.getAttributions}, + * {@link Object.getAttachments}, * but returns their \`@id\`s instead of the objects themselves. */ - get attributionIds(): URL[] { + get attachmentIds(): URL[] { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.map((v) => + return this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.map((v) => v instanceof URL ? v : v.id! ).filter(id => id !== null); } -/** Identifies one or more entities to which this object is attributed. - * The attributed entities might not be Actors. For instance, - * an object might be attributed to the completion of another activity. +/** Identifies a resource attached or related to an object that potentially + * requires special handling. The intent is to provide a model that is at + * least semantically similar to attachments in email. * */ - async* getAttributions( + async* getAttachments( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2498,27 +2289,27 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {} - ): AsyncIterable { + ): AsyncIterable { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAttribution(v, options); + await this.#fetchAttachment(v, options); if (fetched == null) continue; vs[i] = fetched; - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); this._cachedJsonLd = undefined; yield fetched; continue; @@ -2528,19 +2319,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"attributedTo\\" in this._cachedJsonLd + \\"attachment\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"attributedTo\\"]; + \\"attachment\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attribution_fromJsonLd(obj, options); + v = await this.#attachment_fromJsonLd(obj, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -2564,7 +2355,7 @@ proofs?: (DataIntegrityProof | URL)[];} } } - async #fetchAudience( + async #fetchAttribution( url: URL, options: { documentLoader?: DocumentLoader, @@ -2573,7 +2364,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2606,7 +2397,7 @@ proofs?: (DataIntegrityProof | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#audience_fromJsonLd( + const obj = await this.#attribution_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -2655,7 +2446,7 @@ proofs?: (DataIntegrityProof | URL)[];} }); } - async #audience_fromJsonLd( + async #attribution_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -2663,7 +2454,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL } - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2673,7 +2464,43 @@ proofs?: (DataIntegrityProof | URL)[];} const baseUrl = options.baseUrl; try { - return await Object.fromJsonLd( + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2682,34 +2509,35 @@ proofs?: (DataIntegrityProof | URL)[];} } throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); } /** * Similar to - * {@link Object.getAudience}, + * {@link Object.getAttribution}, * but returns its \`@id\` URL instead of the object itself. */ - get audienceId(): URL | null { + get attributionId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; - const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; + const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (v instanceof URL) return v; return v.id; } -/** Identifies one or more entities that represent the total population of - * entities for which the object can considered to be relevant. +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. * */ - async getAudience( + async getAttribution( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2717,26 +2545,26 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {} - ): Promise { + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; - let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; + let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAudience(v, options); + await this.#fetchAttribution(v, options); if (fetched == null) return null; - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(0); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(0); this._cachedJsonLd = undefined; return fetched; } @@ -2745,19 +2573,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"audience\\" in this._cachedJsonLd + \\"attributedTo\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"audience\\"]; + \\"attributedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#audience_fromJsonLd(doc, options); + v = await this.#attribution_fromJsonLd(doc, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -2782,27 +2610,28 @@ proofs?: (DataIntegrityProof | URL)[];} /** * Similar to - * {@link Object.getAudiences}, + * {@link Object.getAttributions}, * but returns their \`@id\`s instead of the objects themselves. */ - get audienceIds(): URL[] { + get attributionIds(): URL[] { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.map((v) => + return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.map((v) => v instanceof URL ? v : v.id! ).filter(id => id !== null); } -/** Identifies one or more entities that represent the total population of - * entities for which the object can considered to be relevant. +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. * */ - async* getAudiences( + async* getAttributions( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2810,27 +2639,27 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {} - ): AsyncIterable { + ): AsyncIterable { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAudience(v, options); + await this.#fetchAttribution(v, options); if (fetched == null) continue; vs[i] = fetched; - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); this._cachedJsonLd = undefined; yield fetched; continue; @@ -2840,19 +2669,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"audience\\" in this._cachedJsonLd + \\"attributedTo\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"audience\\"]; + \\"attributedTo\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#audience_fromJsonLd(obj, options); + v = await this.#attribution_fromJsonLd(obj, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -2876,36 +2705,7 @@ proofs?: (DataIntegrityProof | URL)[];} } } -/** The content or textual representation of the Object encoded as a JSON - * string. By default, the value of \`content\` is HTML. The \`mediaType\` - * property can be used in the object to indicate a different content type. - * - * The content MAY be expressed using multiple language-tagged values. - * - */ - get content(): (string | LanguageString | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) return null; - return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; - } - -/** The content or textual representation of the Object encoded as a JSON - * string. By default, the value of \`content\` is HTML. The \`mediaType\` - * property can be used in the object to indicate a different content type. - * - * The content MAY be expressed using multiple language-tagged values. - * - */ -get contents(): ((string | LanguageString))[] { - return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; - } - - async #fetchContext( + async #fetchAudience( url: URL, options: { documentLoader?: DocumentLoader, @@ -2914,7 +2714,7 @@ get contents(): ((string | LanguageString))[] { tracerProvider?: TracerProvider, crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2947,7 +2747,348 @@ get contents(): ((string | LanguageString))[] { const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#context_fromJsonLd( + const obj = await this.#audience_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #audience_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getAudience}, + * but returns its \`@id\` URL instead of the object itself. + */ + get audienceId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; + const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async getAudience( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; + let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + if (fetched == null) return null; + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"audience\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"audience\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#audience_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Object.getAudiences}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get audienceIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async* getAudiences( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"audience\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"audience\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#audience_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ + get content(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) return null; + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ +get contents(): ((string | LanguageString))[] { + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; + } + + async #fetchContext( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#context_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -7808,174 +7949,861 @@ get urls(): ((URL | Link))[] { } } - /** - * Converts this object to a JSON-LD structure. - * @param options The options to use. - * - \`format\`: The format of the output: \`compact\` or - \`expand\`. - * - \`contextLoader\`: The loader for remote JSON-LD contexts. - * - \`context\`: The JSON-LD context to use. Not applicable - when \`format\` is set to \`'expand'\`. - * @returns The JSON-LD representation of this object. - */ - async toJsonLd(options: { - format?: \\"compact\\" | \\"expand\\", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], - } = {}): Promise { - if (options.format == null && this._cachedJsonLd != null) { - return this._cachedJsonLd; - } - if (options.format !== \\"compact\\" && options.context != null) { - throw new TypeError( - \\"The context option can only be used when the format option is set \\" + - \\"to 'compact'.\\" - ); - } - options = { - ...options, - contextLoader: options.contextLoader ?? getDocumentLoader(), - }; - - if (options.format == null && this.isCompactable()) { - const result: Record = {}; - // deno-lint-ignore no-unused-vars - let compactItems: unknown[]; - - compactItems = []; - for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { - const item = ( - v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Link ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); +/** The interaction policy for this object, specifying who can like, reply to, + * or announce it. Contains sub-policies (\`canLike\`, \`canReply\`, + * \`canAnnounce\`) each defining \`automaticApproval\` and \`manualApproval\` + * lists. + * + * When absent, implementations should assume anyone can interact with + * the object. Setting this property signals that the server understands + * and will enforce interaction controls. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * + */ + get interactionPolicy(): (InteractionPolicy | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length < 1) return null; + return this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[0]; } - if (compactItems.length > 0) { - result[\\"attachment\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - +/** A URI referencing an authorization object that proves this interaction + * was approved by the target post's author. + * + */ + get approvedBy(): (URL | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length < 1) return null; + return this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[0]; } - compactItems = []; - for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { - const item = ( - v instanceof URL ? v.href : v instanceof Application ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Group ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Organization ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Person ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); + async #fetchLikeAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#likeAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #likeAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL } - if (compactItems.length > 0) { + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await LikeAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - result[\\"attributedTo\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://gotosocial.org/ns#LikeApproval\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getLikeAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get likeAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < 1) return null; + const v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + if (v instanceof URL) return v; + return v.id; } - compactItems = []; - for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); - } - if (compactItems.length > 0) { +/** A {@link LikeAuthorization} object that proves this like interaction + * was approved by the target post's author. + * + */ + + async getLikeAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < 1) return null; + let v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchLikeAuthorization(v, options); + if (fetched == null) return null; + this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0] = fetched; + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } - result[\\"audience\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"likeAuthorization\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"likeAuthorization\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#likeAuthorization_fromJsonLd(doc, options); + } + } + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } - compactItems = []; - for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { - const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } - ); - compactItems.push(item); + async #fetchReplyAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#replyAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #replyAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL } - if (compactItems.length > 0) { + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await ReplyAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - result[\\"content\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://gotosocial.org/ns#ReplyAuthorization\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getReplyAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get replyAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < 1) return null; + const v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + if (v instanceof URL) return v; + return v.id; } - compactItems = []; - for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { - const item = ( - v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); - } - if (compactItems.length > 0) { +/** A {@link ReplyAuthorization} object that proves this reply was approved + * by the target post's author. + * + */ + + async getReplyAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < 1) return null; + let v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchReplyAuthorization(v, options); + if (fetched == null) return null; + this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0] = fetched; + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } - result[\\"context\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"replyAuthorization\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"replyAuthorization\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#replyAuthorization_fromJsonLd(doc, options); + } + } - } - - compactItems = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { - const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + async #fetchAnnounceAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#announceAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #announceAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await AnnounceAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://gotosocial.org/ns#AnnounceAuthorization\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Object.getAnnounceAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get announceAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < 1) return null; + const v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** An {@link AnnounceAuthorization} object that proves this announce + * (boost) was approved by the target post's author. + * + */ + + async getAnnounceAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < 1) return null; + let v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAnnounceAuthorization(v, options); + if (fetched == null) return null; + this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0] = fetched; + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"announceAuthorization\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"announceAuthorization\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#announceAuthorization_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + const result: Record = {}; + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + const item = ( + v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Link ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"attachment\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + const item = ( + v instanceof URL ? v.href : v instanceof Application ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Group ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Organization ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Person ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"attributedTo\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"audience\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"content\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + const item = ( + v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"context\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } ); compactItems.push(item); } @@ -8499,9 +9327,105 @@ get urls(): ((URL | Link))[] { } + compactItems = []; + for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + const item = ( + await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactionPolicy\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + const item = ( + v.href + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"approvedBy\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"likeAuthorization\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"replyAuthorization\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"announceAuthorization\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + result[\\"type\\"] = \\"Object\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -9012,6 +9936,81 @@ get urls(): ((URL | Link))[] { } + array = []; + for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#interactionPolicy\\"] = propValue; + + } + + array = []; + for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + const element = ( + { \\"@id\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#approvedBy\\"] = propValue; + + } + + array = []; + for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#likeAuthorization\\"] = propValue; + + } + + array = []; + for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#replyAuthorization\\"] = propValue; + + } + + array = []; + for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#announceAuthorization\\"] = propValue; + + } + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Object\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { @@ -9021,7 +10020,7 @@ get urls(): ((URL | Link))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -9067,6 +10066,11 @@ get urls(): ((URL | Link))[] { this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0 ) return false; + if ( + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy != null && + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length > 0 + ) return false; + return true; } @@ -9169,6 +10173,18 @@ get urls(): ((URL | Link))[] { return await ChatMessage.fromJsonLd(json, options); } + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceAuthorization\\")) { + return await AnnounceAuthorization.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeApproval\\")) { + return await LikeAuthorization.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyAuthorization\\")) { + return await ReplyAuthorization.fromJsonLd(json, options); + } + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { return await Activity.fromJsonLd(json, options); } @@ -9177,6 +10193,18 @@ get urls(): ((URL | Link))[] { return await EmojiReact.fromJsonLd(json, options); } + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceRequest\\")) { + return await AnnounceRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeRequest\\")) { + return await LikeRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyRequest\\")) { + return await ReplyRequest.fromJsonLd(json, options); + } + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { return await Accept.fromJsonLd(json, options); } @@ -9413,7 +10441,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9567,7 +10595,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9653,7 +10681,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9756,7 +10784,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9799,7 +10827,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -9847,7 +10875,7 @@ get urls(): ((URL | Link))[] { v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -10067,7 +11095,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -10358,6 +11386,144 @@ get urls(): ((URL | Link))[] { )) } instance.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + const _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; + + let _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array = values[\\"https://gotosocial.org/ns#interactionPolicy\\"]; + + for ( + const v of _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array == null + ? [] + : _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array.length === 1 && \\"@list\\" in _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array[0] + ? _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array[0][\\"@list\\"] + : _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array + ) { + if (v == null) continue; + _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.push(await InteractionPolicy.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + const _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; + + let _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array = values[\\"https://gotosocial.org/ns#approvedBy\\"]; + + for ( + const v of _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array == null + ? [] + : _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array.length === 1 && \\"@list\\" in _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array[0] + ? _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array[0][\\"@list\\"] + : _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array + ) { + if (v == null) continue; + _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.push(v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + + encodeURIComponent( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(5, v[\\"@id\\"].indexOf(\\"/\\", 5)) + : v[\\"@id\\"].slice(5) + ) + + ( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(v[\\"@id\\"].indexOf(\\"/\\", 5)) + : \\"\\" + ) + ) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + ? new URL(v[\\"@id\\"]) + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])))) + } + instance.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + + const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; + const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + + let _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array = values[\\"https://gotosocial.org/ns#likeAuthorization\\"]; + + for ( + const v of _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array == null + ? [] + : _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array.length === 1 && \\"@list\\" in _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array[0] + ? _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array[0][\\"@list\\"] + : _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push(await LikeAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; + + const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; + const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + + let _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array = values[\\"https://gotosocial.org/ns#replyAuthorization\\"]; + + for ( + const v of _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array == null + ? [] + : _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array.length === 1 && \\"@list\\" in _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array[0] + ? _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array[0][\\"@list\\"] + : _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push(await ReplyAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; + + const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; + const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + + let _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array = values[\\"https://gotosocial.org/ns#announceAuthorization\\"]; + + for ( + const v of _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array == null + ? [] + : _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array.length === 1 && \\"@list\\" in _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array[0] + ? _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array[0][\\"@list\\"] + : _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(await AnnounceAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -10871,223 +12037,5428 @@ get urls(): ((URL | Link))[] { } : v); - if (_5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 1 - || !(\\"tag\\" in proxy) - && _5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 0) { - proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + if (_5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 1 + || !(\\"tag\\" in proxy) + && _5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 0) { + proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + } + + const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length == 1) { + proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + } + + const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) { + proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + } + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 + || !(\\"url\\" in proxy) + && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) { + proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + } + + const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length == 1) { + proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + } + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 1 + || !(\\"to\\" in proxy) + && _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 0) { + proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + } + + const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length == 1) { + proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; + } + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 1 + || !(\\"bto\\" in proxy) + && _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 0) { + proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + } + + const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length == 1) { + proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; + } + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 1 + || !(\\"cc\\" in proxy) + && _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 0) { + proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + } + + const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length == 1) { + proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + } + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 1 + || !(\\"bcc\\" in proxy) + && _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 0) { + proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + } + + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length == 1) { + proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; + } + + const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length == 1) { + proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; + } + + const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length == 1) { + proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + } + + const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length == 1) { + proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + } + + const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length == 1) { + proxy.proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; + } + + if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 1 + || !(\\"proof\\" in proxy) + && _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) { + proxy.proofs = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + } + + const _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length == 1) { + proxy.interactionPolicy = _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[0]; + } + + const _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length == 1) { + proxy.approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[0]; + } + + const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length == 1) { + proxy.likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + } + + const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length == 1) { + proxy.replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + } + + const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length == 1) { + proxy.announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Object.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: Object, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Object \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Object.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: Object, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Object \\" + inspect(proxy, options); + }; + /** Represents a custom emoji. + */ +export class Emoji extends Object { + + /** + * The type URI of {@link Emoji}: \`http://joinmastodon.org/ns#Emoji\`. + */ + static override get typeId(): URL { + return new URL(\\"http://joinmastodon.org/ns#Emoji\\"); + } + + /** + * Constructs a new instance of Emoji with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): Emoji { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Emoji; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + result[\\"type\\"] = \\"Emoji\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + return result; + } + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + values[\\"@type\\"] = [\\"http://joinmastodon.org/ns#Emoji\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__Emoji__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__Emoji__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://joinmastodon.org/ns#Emoji\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof Emoji)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Emoji.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: Emoji, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Emoji \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Emoji.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: Emoji, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Emoji \\" + inspect(proxy, options); + }; + /** \`ChatMessage\`s are the messages sent in 1-on-1 chats. They are similar to + * {@link Note}s, but the addressing is done by having a single AP actor in + * the \`to\` field. Addressing multiple actors is not allowed. These messages + * are always private, there is no public version of them. They are created with + * a {@link Create} activity. + * + */ +export class ChatMessage extends Object { + + /** + * The type URI of {@link ChatMessage}: \`http://litepub.social/ns#ChatMessage\`. + */ + static override get typeId(): URL { + return new URL(\\"http://litepub.social/ns#ChatMessage\\"); + } + #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; + + /** + * Constructs a new instance of ChatMessage with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if (\\"quoteUrl\\" in values && values.quoteUrl != null) { + if (values.quoteUrl instanceof URL) { + // @ts-ignore: type is checked above. + this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; + + } else { + throw new TypeError( + \\"The quoteUrl must be of type \\" + + \\"URL\\" + \\".\\", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): ChatMessage { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + if (\\"quoteUrl\\" in values && values.quoteUrl != null) { + if (values.quoteUrl instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; + + } else { + throw new TypeError( + \\"The quoteUrl must be of type \\" + + \\"URL\\" + \\".\\", + ); + } + } + + return clone; + } + +/** The URI of the ActivityStreams object that this object quotes. + * + * This property sets three JSON-LD properties at once under the hood: + * + * 1. https://www.w3.org/ns/activitystreams#quoteUrl + * 2. https://misskey-hub.net/ns#_misskey_quote + * 3. http://fedibird.com/ns#quoteUri + * + * When a JSON-LD object is parsed, this property is filled with one of + * the values of those three properties in order. + * + */ + get quoteUrl(): (URL | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < 1) return null; + return this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + const item = ( + v.href + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"quoteUrl\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result[\\"_misskey_quote\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result[\\"quoteUri\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result[\\"type\\"] = \\"ChatMessage\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + return result; + } + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + array = []; + for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + const element = ( + { \\"@value\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"] = propValue; + + values[\\"https://misskey-hub.net/ns#_misskey_quote\\"] = propValue; + + values[\\"http://fedibird.com/ns#quoteUri\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"http://litepub.social/ns#ChatMessage\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__ChatMessage__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__ChatMessage__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#ChatMessage\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ChatMessage)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; + + let _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"]; + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://misskey-hub.net/ns#_misskey_quote\\"]; + } + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"http://fedibird.com/ns#quoteUri\\"]; + } + + 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 + ) { + if (v == null) continue; + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v[\\"@value\\"])) + } + instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length == 1) { + proxy.quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(ChatMessage.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: ChatMessage, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ChatMessage \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(ChatMessage.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: ChatMessage, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ChatMessage \\" + inspect(proxy, options); + }; + /** An Activity is a subtype of {@link Object} that describes some form of action + * that may happen, is currently happening, or has already happened. + * The {@link Activity} type itself serves as an abstract base type for all types + * of activities. It is important to note that the {@link Activity} type itself + * does not carry any specific semantics about the kind of action being taken. + * + */ +export class Activity extends Object { + + /** + * The type URI of {@link Activity}: \`https://www.w3.org/ns/activitystreams#Activity\`. + */ + static override get typeId(): URL { + return new URL(\\"https://www.w3.org/ns/activitystreams#Activity\\"); + } + + #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + + #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + + #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + + #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + + #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + + #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + + /** + * Constructs a new instance of Activity with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if (\\"actor\\" in values && values.actor != null) { + if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); + } else { + throw new TypeError( + \\"The actor must be of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + + if (\\"actors\\" in values && values.actors != null) { + + if (\\"actor\\" in values && + values.actor != null) { + throw new TypeError( + \\"Cannot initialize both actor and \\" + + \\"actors at the same time.\\", + ); + } + + if (Array.isArray(values.actors) && + values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; + + for (let i = 0; i < values.actors.length; i++) { + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + } + + } else { + throw new TypeError( + \\"The actors must be an array of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + + if (\\"object\\" in values && values.object != null) { + if (values.object instanceof Object || values.object instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); + } else { + throw new TypeError( + \\"The object must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot initialize both object and \\" + + \\"objects at the same time.\\", + ); + } + + if (Array.isArray(values.objects) && + values.objects.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; + + for (let i = 0; i < values.objects.length; i++) { + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + } + + } else { + throw new TypeError( + \\"The objects must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"target\\" in values && values.target != null) { + if (values.target instanceof Object || values.target instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); + } else { + throw new TypeError( + \\"The target must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"targets\\" in values && values.targets != null) { + + if (\\"target\\" in values && + values.target != null) { + throw new TypeError( + \\"Cannot initialize both target and \\" + + \\"targets at the same time.\\", + ); + } + + if (Array.isArray(values.targets) && + values.targets.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; + + for (let i = 0; i < values.targets.length; i++) { + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + } + + } else { + throw new TypeError( + \\"The targets must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"result\\" in values && values.result != null) { + if (values.result instanceof Object || values.result instanceof URL) { + // @ts-ignore: type is checked above. + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); + } else { + throw new TypeError( + \\"The result must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"results\\" in values && values.results != null) { + + if (\\"result\\" in values && + values.result != null) { + throw new TypeError( + \\"Cannot initialize both result and \\" + + \\"results at the same time.\\", + ); + } + + if (Array.isArray(values.results) && + values.results.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; + + for (let i = 0; i < values.results.length; i++) { + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + } + + } else { + throw new TypeError( + \\"The results must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"origin\\" in values && values.origin != null) { + if (values.origin instanceof Object || values.origin instanceof URL) { + // @ts-ignore: type is checked above. + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); + } else { + throw new TypeError( + \\"The origin must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"origins\\" in values && values.origins != null) { + + if (\\"origin\\" in values && + values.origin != null) { + throw new TypeError( + \\"Cannot initialize both origin and \\" + + \\"origins at the same time.\\", + ); + } + + if (Array.isArray(values.origins) && + values.origins.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; + + for (let i = 0; i < values.origins.length; i++) { + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + } + + } else { + throw new TypeError( + \\"The origins must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"instrument\\" in values && values.instrument != null) { + if (values.instrument instanceof Object || values.instrument instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + } else { + throw new TypeError( + \\"The instrument must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"instruments\\" in values && values.instruments != null) { + + if (\\"instrument\\" in values && + values.instrument != null) { + throw new TypeError( + \\"Cannot initialize both instrument and \\" + + \\"instruments at the same time.\\", + ); + } + + if (Array.isArray(values.instruments) && + values.instruments.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + + for (let i = 0; i < values.instruments.length; i++) { + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + } + + } else { + throw new TypeError( + \\"The instruments must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): Activity { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor;clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); + if (\\"actor\\" in values && values.actor != null) { + if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); + } else { + throw new TypeError( + \\"The actor must be of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + + if (\\"actors\\" in values && values.actors != null) { + + if (\\"actor\\" in values && + values.actor != null) { + throw new TypeError( + \\"Cannot update both actor and \\" + + \\"actors at the same time.\\", + ); + } + + if (Array.isArray(values.actors) && + values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; + + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); + for (let i = 0; i < values.actors.length; i++) { + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + } + + } else { + throw new TypeError( + \\"The actors must be an array of type \\" + + \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", + ); + } + } + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object;clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + if (\\"object\\" in values && values.object != null) { + if (values.object instanceof Object || values.object instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + } else { + throw new TypeError( + \\"The object must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"objects\\" in values && values.objects != null) { + + if (\\"object\\" in values && + values.object != null) { + throw new TypeError( + \\"Cannot update both object and \\" + + \\"objects at the same time.\\", + ); + } + + if (Array.isArray(values.objects) && + values.objects.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; + + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + for (let i = 0; i < values.objects.length; i++) { + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + } + + } else { + throw new TypeError( + \\"The objects must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target;clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); + if (\\"target\\" in values && values.target != null) { + if (values.target instanceof Object || values.target instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); + } else { + throw new TypeError( + \\"The target must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"targets\\" in values && values.targets != null) { + + if (\\"target\\" in values && + values.target != null) { + throw new TypeError( + \\"Cannot update both target and \\" + + \\"targets at the same time.\\", + ); + } + + if (Array.isArray(values.targets) && + values.targets.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; + + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); + for (let i = 0; i < values.targets.length; i++) { + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + } + + } else { + throw new TypeError( + \\"The targets must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result;clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); + if (\\"result\\" in values && values.result != null) { + if (values.result instanceof Object || values.result instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); + } else { + throw new TypeError( + \\"The result must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"results\\" in values && values.results != null) { + + if (\\"result\\" in values && + values.result != null) { + throw new TypeError( + \\"Cannot update both result and \\" + + \\"results at the same time.\\", + ); + } + + if (Array.isArray(values.results) && + values.results.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; + + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); + for (let i = 0; i < values.results.length; i++) { + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + } + + } else { + throw new TypeError( + \\"The results must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin;clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); + if (\\"origin\\" in values && values.origin != null) { + if (values.origin instanceof Object || values.origin instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); + } else { + throw new TypeError( + \\"The origin must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"origins\\" in values && values.origins != null) { + + if (\\"origin\\" in values && + values.origin != null) { + throw new TypeError( + \\"Cannot update both origin and \\" + + \\"origins at the same time.\\", + ); + } + + if (Array.isArray(values.origins) && + values.origins.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; + + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); + for (let i = 0; i < values.origins.length; i++) { + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + } + + } else { + throw new TypeError( + \\"The origins must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument;clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); + if (\\"instrument\\" in values && values.instrument != null) { + if (values.instrument instanceof Object || values.instrument instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); + } else { + throw new TypeError( + \\"The instrument must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"instruments\\" in values && values.instruments != null) { + + if (\\"instrument\\" in values && + values.instrument != null) { + throw new TypeError( + \\"Cannot update both instrument and \\" + + \\"instruments at the same time.\\", + ); + } + + if (Array.isArray(values.instruments) && + values.instruments.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); + for (let i = 0; i < values.instruments.length; i++) { + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + } + + } else { + throw new TypeError( + \\"The instruments must be an array of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + return clone; + } + + async #fetchActor( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#actor_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #actor_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getActor}, + * but returns its \`@id\` URL instead of the object itself. + */ + get actorId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; + const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async getActor( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; + let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + if (fetched == null) return null; + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"actor\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"actor\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#actor_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getActors}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get actorIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async* getActors( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"actor\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"actor\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#actor_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#object_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #object_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get objectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity \\"John added a movie to his + * wishlist\\", the object of the activity is the movie added. + * + */ + + async getObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; + let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + if (fetched == null) return null; + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"object\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"object\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#object_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getObjects}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get objectIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity \\"John added a movie to his + * wishlist\\", the object of the activity is the movie added. + * + */ + + async* getObjects( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"object\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"object\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#object_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#target_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #target_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get targetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; + const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the indirect object, or target, of the activity. The precise + * meaning of the target is largely dependent on the type of action being + * described but will often be the object of the English preposition \\"to\\". + * For instance, in the activity \\"John added a movie to his wishlist\\", + * the target of the activity is John's wishlist. An activity can have more + * than one target. + * + */ + + async getTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; + let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchTarget(v, options); + if (fetched == null) return null; + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"target\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"target\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#target_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getTargets}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get targetIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the indirect object, or target, of the activity. The precise + * meaning of the target is largely dependent on the type of action being + * described but will often be the object of the English preposition \\"to\\". + * For instance, in the activity \\"John added a movie to his wishlist\\", + * the target of the activity is John's wishlist. An activity can have more + * than one target. + * + */ + + async* getTargets( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchTarget(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"target\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"target\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#target_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchResult( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#result_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #result_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getResult}, + * but returns its \`@id\` URL instead of the object itself. + */ + get resultId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; + const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the result of the activity. For instance, if a particular action + * results in the creation of a new resource, the result property can be used + * to describe that new resource. + * + */ + + async getResult( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; + let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchResult(v, options); + if (fetched == null) return null; + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"result\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"result\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#result_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getResults}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get resultIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the result of the activity. For instance, if a particular action + * results in the creation of a new resource, the result property can be used + * to describe that new resource. + * + */ + + async* getResults( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchResult(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"result\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"result\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#result_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchOrigin( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#origin_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #origin_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getOrigin}, + * but returns its \`@id\` URL instead of the object itself. + */ + get originId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; + const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes an indirect object of the activity from which the activity is + * directed. The precise meaning of the origin is the object of the English + * preposition \\"from\\". For instance, in the activity \\"John moved an item to + * List B from List A\\", the origin of the activity is \\"List A\\". + * + */ + + async getOrigin( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; + let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchOrigin(v, options); + if (fetched == null) return null; + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"origin\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"origin\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#origin_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getOrigins}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get originIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes an indirect object of the activity from which the activity is + * directed. The precise meaning of the origin is the object of the English + * preposition \\"from\\". For instance, in the activity \\"John moved an item to + * List B from List A\\", the origin of the activity is \\"List A\\". + * + */ + + async* getOrigins( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchOrigin(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"origin\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"origin\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#origin_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchInstrument( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#instrument_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #instrument_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link Activity.getInstrument}, + * but returns its \`@id\` URL instead of the object itself. + */ + get instrumentId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; + const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more objects used (or to be used) in the completion of + * an {@link Activity}. + * + */ + + async getInstrument( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; + let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInstrument(v, options); + if (fetched == null) return null; + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"instrument\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"instrument\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#instrument_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getInstruments}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get instrumentIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more objects used (or to be used) in the completion of + * an {@link Activity}. + * + */ + + async* getInstruments( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInstrument(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"instrument\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"instrument\\"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { + v = await this.#instrument_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + array = []; + for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#actor\\"] = propValue; + + } + + array = []; + for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#object\\"] = propValue; + + } + + array = []; + for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#target\\"] = propValue; + + } + + array = []; + for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#result\\"] = propValue; + + } + + array = []; + for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#origin\\"] = propValue; + + } + + array = []; + for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#instrument\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Activity\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__Activity__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__Activity__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { + return await EmojiReact.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceRequest\\")) { + return await AnnounceRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeRequest\\")) { + return await LikeRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyRequest\\")) { + return await ReplyRequest.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { + return await Accept.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\")) { + return await TentativeAccept.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Add\\")) { + return await Add.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Announce\\")) { + return await Announce.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Create\\")) { + return await Create.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Delete\\")) { + return await Delete.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Dislike\\")) { + return await Dislike.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Flag\\")) { + return await Flag.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Follow\\")) { + return await Follow.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { + return await Ignore.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { + return await Block.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\")) { + return await IntransitiveActivity.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Arrive\\")) { + return await Arrive.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Question\\")) { + return await Question.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Travel\\")) { + return await Travel.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Join\\")) { + return await Join.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Leave\\")) { + return await Leave.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Like\\")) { + return await Like.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Listen\\")) { + return await Listen.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Move\\")) { + return await Move.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Offer\\")) { + return await Offer.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Invite\\")) { + return await Invite.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Read\\")) { + return await Read.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Reject\\")) { + return await Reject.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeReject\\")) { + return await TentativeReject.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Remove\\")) { + return await Remove.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Undo\\")) { + return await Undo.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Update\\")) { + return await Update.fromJsonLd(json, options); + } + + if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#View\\")) { + return await View.fromJsonLd(json, options); + } + + if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof Activity)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + + let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values[\\"https://www.w3.org/ns/activitystreams#actor\\"]; + + for ( + const v of _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array == null + ? [] + : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array.length === 1 && \\"@list\\" in _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0] + ? _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0][\\"@list\\"] + : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + + const decoded = + typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : typeof v === \\"object\\" && \\"@type\\" in v + && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + ) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); + + } + instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + + let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; + + for ( + const v of _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array == null + ? [] + : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array.length === 1 && \\"@list\\" in _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0] + ? _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0][\\"@list\\"] + : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + + const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + + let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values[\\"https://www.w3.org/ns/activitystreams#target\\"]; + + for ( + const v of _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array == null + ? [] + : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array.length === 1 && \\"@list\\" in _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0] + ? _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0][\\"@list\\"] + : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + + const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + + let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values[\\"https://www.w3.org/ns/activitystreams#result\\"]; + + for ( + const v of _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array == null + ? [] + : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array.length === 1 && \\"@list\\" in _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0] + ? _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0][\\"@list\\"] + : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + + const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + + let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values[\\"https://www.w3.org/ns/activitystreams#origin\\"]; + + for ( + const v of _25zu2s3VxVujgEKqrDycjE284XQR_origin__array == null + ? [] + : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array.length === 1 && \\"@list\\" in _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0] + ? _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0][\\"@list\\"] + : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + + const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + + let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values[\\"https://www.w3.org/ns/activitystreams#instrument\\"]; + + for ( + const v of _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array == null + ? [] + : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array.length === 1 && \\"@list\\" in _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0] + ? _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0][\\"@list\\"] + : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length == 1) { + proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + } + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 1 + || !(\\"actor\\" in proxy) + && _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 0) { + proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + } + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length == 1) { + proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + } + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 1 + || !(\\"object\\" in proxy) + && _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 0) { + proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + } + + const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length == 1) { + proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + } + + if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 1 + || !(\\"target\\" in proxy) + && _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 0) { + proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + } + + const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length == 1) { + proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + } + + if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 1 + || !(\\"result\\" in proxy) + && _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 0) { + proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + } + + const _25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length == 1) { + proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + } + + if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 1 + || !(\\"origin\\" in proxy) + && _25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 0) { + proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + } + + const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length == 1) { + proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + } + + if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 1 + || !(\\"instrument\\" in proxy) + && _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 0) { + proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Activity.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: Activity, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Activity \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Activity.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: Activity, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"Activity \\" + inspect(proxy, options); + }; + /** Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0). + * + */ +export class EmojiReact extends Activity { + + /** + * The type URI of {@link EmojiReact}: \`http://litepub.social/ns#EmojiReact\`. + */ + static override get typeId(): URL { + return new URL(\\"http://litepub.social/ns#EmojiReact\\"); + } + + /** + * Constructs a new instance of EmojiReact with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): EmojiReact { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as EmojiReact; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + values[\\"@type\\"] = [\\"http://litepub.social/ns#EmojiReact\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__EmojiReact__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__EmojiReact__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof EmojiReact)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(EmojiReact.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: EmojiReact, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"EmojiReact \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(EmojiReact.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: EmojiReact, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"EmojiReact \\" + inspect(proxy, options); + }; + /** A pair of property name and value. + */ +export class PropertyValue { + + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. + */ + static get typeId(): URL { + return new URL(\\"http://schema.org#PropertyValue\\"); + } + #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; +#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + + /** + * Constructs a new instance of PropertyValue with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if (\\"$warning\\" in options) { + this.#warning = options.$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError(\\"The id must be a URL.\\"); + } + + if (\\"name\\" in values && values.name != null) { + if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + // @ts-ignore: type is checked above. + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; + + } else { + throw new TypeError( + \\"The name must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + + if (\\"value\\" in values && values.value != null) { + if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + // @ts-ignore: type is checked above. + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; + + } else { + throw new TypeError( + \\"The value must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + clone( + values: + { +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): PropertyValue { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: PropertyValue = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + if (\\"name\\" in values && values.name != null) { + if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + // @ts-ignore: type is checked above. + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; + + } else { + throw new TypeError( + \\"The name must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if (\\"value\\" in values && values.value != null) { + if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + // @ts-ignore: type is checked above. + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; + + } else { + throw new TypeError( + \\"The value must be of type \\" + + \\"string | LanguageString\\" + \\".\\", + ); + } + } + + return clone; + } + +/** The name of a property. + */ + get name(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) return null; + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + } + +/** The value of a property. + */ + get value(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1) return null; + return this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + const result: Record = {}; + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } - - const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length == 1) { - proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + ); + compactItems.push(item); } + if (compactItems.length > 0) { - const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) { - proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + result[\\"name\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } - if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 - || !(\\"url\\" in proxy) - && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) { - proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + compactItems = []; + for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + const item = ( + typeof v === \\"string\\" ? v : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } - - const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length == 1) { - proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + ); + compactItems.push(item); } + if (compactItems.length > 0) { - if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 1 - || !(\\"to\\" in proxy) - && _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 0) { - proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + result[\\"value\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } - const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + result[\\"type\\"] = \\"PropertyValue\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + return result; + } - if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length == 1) { - proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; - } - - if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 1 - || !(\\"bto\\" in proxy) - && _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 0) { - proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const element = ( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } - - const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://www.w3.org/ns/activitystreams#name\\"] = propValue; - if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length == 1) { - proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; - } - - if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 1 - || !(\\"cc\\" in proxy) - && _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 0) { - proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; - } - - const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + } - if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length == 1) { - proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + array = []; + for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + const element = ( + typeof v === \\"string\\" ? { \\"@value\\": v } : { + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"http://schema.org#value\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"http://schema.org#PropertyValue\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + if ( + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 + ) return false; - if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 1 - || !(\\"bcc\\" in proxy) - && _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 0) { - proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; - } + if ( + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null && + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0 + ) return false; - const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__PropertyValue__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__PropertyValue__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = new this( + { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + options, + ); + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; + + let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values[\\"https://www.w3.org/ns/activitystreams#name\\"]; - if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length == 1) { - proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; - } + for ( + const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null + ? [] + : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && \\"@list\\" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] + ? _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0][\\"@list\\"] + : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array + ) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.push(decoded); - const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + } + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + + let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values[\\"http://schema.org#value\\"]; - if (_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length == 1) { - proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; - } + for ( + const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null + ? [] + : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && \\"@list\\" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] + ? _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0][\\"@list\\"] + : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array + ) { + if (v == null) continue; + + const decoded = + typeof v === \\"object\\" && \\"@value\\" in v + && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v + && typeof v[\\"@language\\"] === \\"string\\" + && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined + ; + if (typeof decoded === \\"undefined\\") continue; + _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.push(decoded); - const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); + } + instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - if (_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length == 1) { - proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); } - - const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -11103,11 +17474,11 @@ get urls(): ((URL | Link))[] { } : v); - if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length == 1) { - proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; } - const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -11123,14 +17494,8 @@ get urls(): ((URL | Link))[] { } : v); - if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length == 1) { - proxy.proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; - } - - if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 1 - || !(\\"proof\\" in proxy) - && _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) { - proxy.proofs = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + if (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { + proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; } return proxy; @@ -11139,40 +17504,55 @@ get urls(): ((URL | Link))[] { // deno-lint-ignore no-explicit-any -(Object.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(PropertyValue.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: Object, + this: PropertyValue, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Object \\" + inspect(proxy, options); + return \\"PropertyValue \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Object.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(PropertyValue.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: Object, + this: PropertyValue, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Object \\" + inspect(proxy, options); + return \\"PropertyValue \\" + inspect(proxy, options); }; - /** Represents a custom emoji. + /** Proves that an {@link Announce} interaction has been approved by + * the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that an announce (boost) was authorized. The \`attributedTo\` property + * identifies the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * */ -export class Emoji extends Object { +export class AnnounceAuthorization extends Object { /** - * The type URI of {@link Emoji}: \`http://joinmastodon.org/ns#Emoji\`. + * The type URI of {@link AnnounceAuthorization}: \`https://gotosocial.org/ns#AnnounceAuthorization\`. */ static override get typeId(): URL { - return new URL(\\"http://joinmastodon.org/ns#Emoji\\"); + return new URL(\\"https://gotosocial.org/ns#AnnounceAuthorization\\"); } + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + /** - * Constructs a new instance of Emoji with the given values. + * Constructs a new instance of AnnounceAuthorization with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -11196,7 +17576,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -11204,7 +17584,33 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, } = {}, ) { - super(values, options);} + super(values, options); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -11232,14 +17638,14 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): Emoji { + ): AnnounceAuthorization { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -11248,10 +17654,467 @@ proofs?: (DataIntegrityProof | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Emoji; + const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } + } + return clone; } + async #fetchInteractingObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactingObject_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactingObject_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link AnnounceAuthorization.getInteractingObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactingObjectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the interaction (e.g., an {@link Announce} activity) that + * has been authorized. + * + */ + + async getInteractingObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactingObject\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactingObject\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + async #fetchInteractionTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactionTarget_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactionTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link AnnounceAuthorization.getInteractionTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactionTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the post that is the target of the authorized announce. + * + */ + + async getInteractionTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractionTarget(v, options); + if (fetched == null) return null; + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactionTarget\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactionTarget\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactionTarget_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -11292,9 +18155,49 @@ proofs?: (DataIntegrityProof | URL)[];} // deno-lint-ignore no-unused-vars let compactItems: unknown[]; - result[\\"type\\"] = \\"Emoji\\"; + compactItems = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactingObject\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactionTarget\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result[\\"type\\"] = \\"AnnounceAuthorization\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -11311,7 +18214,37 @@ proofs?: (DataIntegrityProof | URL)[];} unknown[] | { \\"@list\\": unknown[] } | string >; - values[\\"@type\\"] = [\\"http://joinmastodon.org/ns#Emoji\\"]; + array = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#interactingObject\\"] = propValue; + + } + + array = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const element = ( + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#interactionTarget\\"] = propValue; + + } + + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#AnnounceAuthorization\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -11320,7 +18253,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -11368,7 +18301,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -11378,7 +18311,7 @@ proofs?: (DataIntegrityProof | URL)[];} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__Emoji__( + const object = await this.__fromJsonLd__AnnounceAuthorization__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -11397,7 +18330,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } - protected static async __fromJsonLd__Emoji__( + protected static async __fromJsonLd__AnnounceAuthorization__( json: unknown, span: Span, options: { @@ -11406,7 +18339,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -11440,7 +18373,7 @@ proofs?: (DataIntegrityProof | URL)[];} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://joinmastodon.org/ns#Emoji\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceAuthorization\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -11451,10 +18384,70 @@ proofs?: (DataIntegrityProof | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof Emoji)) { + if (!(instance instanceof AnnounceAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; + + for ( + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null + ? [] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && \\"@list\\" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0][\\"@list\\"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; + + for ( + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null + ? [] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && \\"@list\\" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0][\\"@list\\"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array + ) { + if (v == null) continue; + + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -11470,52 +18463,97 @@ proofs?: (DataIntegrityProof | URL)[];} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + } + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + } + return proxy; } } // deno-lint-ignore no-explicit-any -(Emoji.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(AnnounceAuthorization.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: Emoji, + this: AnnounceAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Emoji \\" + inspect(proxy, options); + return \\"AnnounceAuthorization \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Emoji.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(AnnounceAuthorization.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: Emoji, + this: AnnounceAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Emoji \\" + inspect(proxy, options); + return \\"AnnounceAuthorization \\" + inspect(proxy, options); }; - /** \`ChatMessage\`s are the messages sent in 1-on-1 chats. They are similar to - * {@link Note}s, but the addressing is done by having a single AP actor in - * the \`to\` field. Addressing multiple actors is not allowed. These messages - * are always private, there is no public version of them. They are created with - * a {@link Create} activity. + /** A request to announce (boost) a post that requires approval from + * the post author. + * + * The \`object\` property references the post to be announced, and + * the \`instrument\` property contains the {@link Announce} activity itself. + * + * The post author responds with an {@link Accept} (with an + * {@link AnnounceAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class ChatMessage extends Object { +export class AnnounceRequest extends Activity { /** - * The type URI of {@link ChatMessage}: \`http://litepub.social/ns#ChatMessage\`. + * The type URI of {@link AnnounceRequest}: \`https://gotosocial.org/ns#AnnounceRequest\`. */ static override get typeId(): URL { - return new URL(\\"http://litepub.social/ns#ChatMessage\\"); + return new URL(\\"https://gotosocial.org/ns#AnnounceRequest\\"); } - #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; - + /** - * Constructs a new instance of ChatMessage with the given values. + * Constructs a new instance of AnnounceRequest with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -11539,7 +18577,13 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} , options: { documentLoader?: DocumentLoader, @@ -11547,20 +18591,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, } = {}, ) { - super(values, options); - if (\\"quoteUrl\\" in values && values.quoteUrl != null) { - if (values.quoteUrl instanceof URL) { - // @ts-ignore: type is checked above. - this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; - - } else { - throw new TypeError( - \\"The quoteUrl must be of type \\" + - \\"URL\\" + \\".\\", - ); - } - } - } + super(values, options);} /** * Clones this instance, optionally updating it with the given values. @@ -11588,14 +18619,20 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): ChatMessage { + ): AnnounceRequest { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -11604,46 +18641,10 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; - if (\\"quoteUrl\\" in values && values.quoteUrl != null) { - if (values.quoteUrl instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; - - } else { - throw new TypeError( - \\"The quoteUrl must be of type \\" + - \\"URL\\" + \\".\\", - ); - } - } - + const clone = super.clone(values, options) as unknown as AnnounceRequest; return clone; } -/** The URI of the ActivityStreams object that this object quotes. - * - * This property sets three JSON-LD properties at once under the hood: - * - * 1. https://www.w3.org/ns/activitystreams#quoteUrl - * 2. https://misskey-hub.net/ns#_misskey_quote - * 3. http://fedibird.com/ns#quoteUri - * - * When a JSON-LD object is parsed, this property is filled with one of - * the values of those three properties in order. - * - */ - get quoteUrl(): (URL | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < 1) return null; - return this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -11673,49 +18674,6 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} contextLoader: options.contextLoader ?? getDocumentLoader(), }; - if (options.format == null && this.isCompactable()) { - - const result = await super.toJsonLd({ - ...options, - format: undefined, - context: undefined, - }) as Record; - - // deno-lint-ignore no-unused-vars - let compactItems: unknown[]; - - compactItems = []; - for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const item = ( - v.href - ); - compactItems.push(item); - } - if (compactItems.length > 0) { - - result[\\"quoteUrl\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result[\\"_misskey_quote\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result[\\"quoteUri\\"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - } - - result[\\"type\\"] = \\"ChatMessage\\"; - if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; - return result; - } - // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; @@ -11729,26 +18687,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} unknown[] | { \\"@list\\": unknown[] } | string >; - array = []; - for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const element = ( - { \\"@value\\": v.href } - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"] = propValue; - - values[\\"https://misskey-hub.net/ns#_misskey_quote\\"] = propValue; - - values[\\"http://fedibird.com/ns#quoteUri\\"] = propValue; - - } - - values[\\"@type\\"] = [\\"http://litepub.social/ns#ChatMessage\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#AnnounceRequest\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -11757,7 +18696,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -11805,7 +18744,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -11815,7 +18754,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__ChatMessage__( + const object = await this.__fromJsonLd__AnnounceRequest__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -11834,7 +18773,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } - protected static async __fromJsonLd__ChatMessage__( + protected static async __fromJsonLd__AnnounceRequest__( json: unknown, span: Span, options: { @@ -11843,7 +18782,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -11877,7 +18816,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#ChatMessage\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#AnnounceRequest\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -11888,32 +18827,9 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof ChatMessage)) { + if (!(instance instanceof AnnounceRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } - const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; - - let _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://www.w3.org/ns/activitystreams#quoteUrl\\"]; - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"https://misskey-hub.net/ns#_misskey_quote\\"]; - } - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values[\\"http://fedibird.com/ns#quoteUri\\"]; - } - - 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 - ) { - if (v == null) continue; - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v[\\"@value\\"])) - } - instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -11930,363 +18846,161 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); - const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length == 1) { - proxy.quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; - } - return proxy; } } // deno-lint-ignore no-explicit-any -(ChatMessage.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(AnnounceRequest.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: ChatMessage, + this: AnnounceRequest, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"ChatMessage \\" + inspect(proxy, options); + return \\"AnnounceRequest \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(ChatMessage.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(AnnounceRequest.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: ChatMessage, + this: AnnounceRequest, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"ChatMessage \\" + inspect(proxy, options); + return \\"AnnounceRequest \\" + inspect(proxy, options); }; - /** An Activity is a subtype of {@link Object} that describes some form of action - * that may happen, is currently happening, or has already happened. - * The {@link Activity} type itself serves as an abstract base type for all types - * of activities. It is important to note that the {@link Activity} type itself - * does not carry any specific semantics about the kind of action being taken. + /** Represents an interaction policy attached to a post, specifying who can + * like, reply to, or announce it. Each sub-policy ({@link InteractionRule}) + * defines which actors receive automatic or manual approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class Activity extends Object { +export class InteractionPolicy { + + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + /** - * The type URI of {@link Activity}: \`https://www.w3.org/ns/activitystreams#Activity\`. + * The type URI of {@link InteractionPolicy}: \`https://gotosocial.org/ns#InteractionPolicy\`. */ - static override get typeId(): URL { - return new URL(\\"https://www.w3.org/ns/activitystreams#Activity\\"); + static get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#InteractionPolicy\\"); } - - #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); - - #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); - - #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); - - #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); - - #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); - - #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); - - /** - * Constructs a new instance of Activity with the given values. - * @param values The values to initialize the instance with. - * @param options The options to use for initialization. - */ - constructor( - values: - { -id?: URL | null; -attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; -attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; -audiences?: (Object | URL)[];content?: string | LanguageString | null; -contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; -names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; -icons?: (Image | URL)[];image?: Image | URL | null; -images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; -replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; -locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; -previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; -summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; -urls?: ((URL | Link))[];to?: Object | URL | null; -tos?: (Object | URL)[];bto?: Object | URL | null; -btos?: (Object | URL)[];cc?: Object | URL | null; -ccs?: (Object | URL)[];bcc?: Object | URL | null; -bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; -actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; -objects?: (Object | URL)[];target?: Object | URL | null; -targets?: (Object | URL)[];result?: Object | URL | null; -results?: (Object | URL)[];origin?: Object | URL | null; -origins?: (Object | URL)[];instrument?: Object | URL | null; -instruments?: (Object | URL)[];} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } = {}, - ) { - super(values, options); - if (\\"actor\\" in values && values.actor != null) { - if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); - } else { - throw new TypeError( - \\"The actor must be of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - - if (\\"actors\\" in values && values.actors != null) { - - if (\\"actor\\" in values && - values.actor != null) { - throw new TypeError( - \\"Cannot initialize both actor and \\" + - \\"actors at the same time.\\", - ); - } - - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; - - for (let i = 0; i < values.actors.length; i++) { - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } - - } else { - throw new TypeError( - \\"The actors must be an array of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - - if (\\"object\\" in values && values.object != null) { - if (values.object instanceof Object || values.object instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); - } else { - throw new TypeError( - \\"The object must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"objects\\" in values && values.objects != null) { - - if (\\"object\\" in values && - values.object != null) { - throw new TypeError( - \\"Cannot initialize both object and \\" + - \\"objects at the same time.\\", - ); - } - - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; - - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } - - } else { - throw new TypeError( - \\"The objects must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"target\\" in values && values.target != null) { - if (values.target instanceof Object || values.target instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); - } else { - throw new TypeError( - \\"The target must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"targets\\" in values && values.targets != null) { - - if (\\"target\\" in values && - values.target != null) { - throw new TypeError( - \\"Cannot initialize both target and \\" + - \\"targets at the same time.\\", - ); - } - - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; - - for (let i = 0; i < values.targets.length; i++) { - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } - - } else { - throw new TypeError( - \\"The targets must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"result\\" in values && values.result != null) { - if (values.result instanceof Object || values.result instanceof URL) { - // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); - } else { - throw new TypeError( - \\"The result must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"results\\" in values && values.results != null) { - - if (\\"result\\" in values && - values.result != null) { - throw new TypeError( - \\"Cannot initialize both result and \\" + - \\"results at the same time.\\", - ); - } - - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + #_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; +#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply: (InteractionRule)[] = []; +#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce: (InteractionRule)[] = []; + + /** + * Constructs a new instance of InteractionPolicy with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if (\\"$warning\\" in options) { + this.#warning = options.$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError(\\"The id must be a URL.\\"); + } + + if (\\"canLike\\" in values && values.canLike != null) { + if (values.canLike instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; - - for (let i = 0; i < values.results.length; i++) { - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } - - } else { - throw new TypeError( - \\"The results must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = [values.canLike]; - if (\\"origin\\" in values && values.origin != null) { - if (values.origin instanceof Object || values.origin instanceof URL) { - // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); } else { throw new TypeError( - \\"The origin must be of type \\" + - \\"Object | URL\\" + \\".\\", + \\"The canLike must be of type \\" + + \\"InteractionRule\\" + \\".\\", ); } } - if (\\"origins\\" in values && values.origins != null) { - - if (\\"origin\\" in values && - values.origin != null) { - throw new TypeError( - \\"Cannot initialize both origin and \\" + - \\"origins at the same time.\\", - ); - } - - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + if (\\"canReply\\" in values && values.canReply != null) { + if (values.canReply instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; - - for (let i = 0; i < values.origins.length; i++) { - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } - - } else { - throw new TypeError( - \\"The origins must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = [values.canReply]; - if (\\"instrument\\" in values && values.instrument != null) { - if (values.instrument instanceof Object || values.instrument instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); } else { throw new TypeError( - \\"The instrument must be of type \\" + - \\"Object | URL\\" + \\".\\", + \\"The canReply must be of type \\" + + \\"InteractionRule\\" + \\".\\", ); } } - if (\\"instruments\\" in values && values.instruments != null) { - - if (\\"instrument\\" in values && - values.instrument != null) { - throw new TypeError( - \\"Cannot initialize both instrument and \\" + - \\"instruments at the same time.\\", - ); - } - - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + if (\\"canAnnounce\\" in values && values.canAnnounce != null) { + if (values.canAnnounce instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = [values.canAnnounce]; - for (let i = 0; i < values.instruments.length; i++) { - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } - } else { throw new TypeError( - \\"The instruments must be an array of type \\" + - \\"Object | URL\\" + \\".\\", + \\"The canAnnounce must be of type \\" + + \\"InteractionRule\\" + \\".\\", ); } } @@ -12298,40 +19012,18 @@ instruments?: (Object | URL)[];} * @param options The options to use for cloning. * @returns The cloned instance. */ - override clone( + clone( values: { id?: URL | null; -attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; -attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; -audiences?: (Object | URL)[];content?: string | LanguageString | null; -contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; -names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; -icons?: (Image | URL)[];image?: Image | URL | null; -images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; -replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; -locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; -previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; -summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; -urls?: ((URL | Link))[];to?: Object | URL | null; -tos?: (Object | URL)[];bto?: Object | URL | null; -btos?: (Object | URL)[];cc?: Object | URL | null; -ccs?: (Object | URL)[];bcc?: Object | URL | null; -bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; -actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; -objects?: (Object | URL)[];target?: Object | URL | null; -targets?: (Object | URL)[];result?: Object | URL | null; -results?: (Object | URL)[];origin?: Object | URL | null; -origins?: (Object | URL)[];instrument?: Object | URL | null; -instruments?: (Object | URL)[];} +canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): Activity { + ): InteractionPolicy { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -12340,1555 +19032,1352 @@ instruments?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor;clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); - if (\\"actor\\" in values && values.actor != null) { - if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); - } else { - throw new TypeError( - \\"The actor must be of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - - if (\\"actors\\" in values && values.actors != null) { - - if (\\"actor\\" in values && - values.actor != null) { - throw new TypeError( - \\"Cannot update both actor and \\" + - \\"actors at the same time.\\", - ); - } - - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; - - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); - for (let i = 0; i < values.actors.length; i++) { - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } - - } else { - throw new TypeError( - \\"The actors must be an array of type \\" + - \\"Application | Group | Organization | Person | Service | URL\\" + \\".\\", - ); - } - } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object;clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); - if (\\"object\\" in values && values.object != null) { - if (values.object instanceof Object || values.object instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); - } else { - throw new TypeError( - \\"The object must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"objects\\" in values && values.objects != null) { - - if (\\"object\\" in values && - values.object != null) { - throw new TypeError( - \\"Cannot update both object and \\" + - \\"objects at the same time.\\", - ); - } - - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; - - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } - - } else { - throw new TypeError( - \\"The objects must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target;clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); - if (\\"target\\" in values && values.target != null) { - if (values.target instanceof Object || values.target instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); - } else { - throw new TypeError( - \\"The target must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"targets\\" in values && values.targets != null) { - - if (\\"target\\" in values && - values.target != null) { - throw new TypeError( - \\"Cannot update both target and \\" + - \\"targets at the same time.\\", - ); - } - - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; - - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); - for (let i = 0; i < values.targets.length; i++) { - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } - - } else { - throw new TypeError( - \\"The targets must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result;clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); - if (\\"result\\" in values && values.result != null) { - if (values.result instanceof Object || values.result instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); - } else { - throw new TypeError( - \\"The result must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"results\\" in values && values.results != null) { - - if (\\"result\\" in values && - values.result != null) { - throw new TypeError( - \\"Cannot update both result and \\" + - \\"results at the same time.\\", - ); - } - - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; - - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); - for (let i = 0; i < values.results.length; i++) { - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } - - } else { - throw new TypeError( - \\"The results must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin;clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); - if (\\"origin\\" in values && values.origin != null) { - if (values.origin instanceof Object || values.origin instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); - } else { - throw new TypeError( - \\"The origin must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"origins\\" in values && values.origins != null) { - - if (\\"origin\\" in values && - values.origin != null) { - throw new TypeError( - \\"Cannot update both origin and \\" + - \\"origins at the same time.\\", - ); - } - - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; - - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); - for (let i = 0; i < values.origins.length; i++) { - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } - - } else { - throw new TypeError( - \\"The origins must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument;clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); - if (\\"instrument\\" in values && values.instrument != null) { - if (values.instrument instanceof Object || values.instrument instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); - } else { - throw new TypeError( - \\"The instrument must be of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - if (\\"instruments\\" in values && values.instruments != null) { - - if (\\"instrument\\" in values && - values.instrument != null) { - throw new TypeError( - \\"Cannot update both instrument and \\" + - \\"instruments at the same time.\\", - ); - } - - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; - - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); - for (let i = 0; i < values.instruments.length; i++) { - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } - - } else { - throw new TypeError( - \\"The instruments must be an array of type \\" + - \\"Object | URL\\" + \\".\\", - ); - } - } - - return clone; - } - async #fetchActor( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } - throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#actor_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); - } - }); - } - - async #actor_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: InteractionPolicy = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + if (\\"canLike\\" in values && values.canLike != null) { + if (values.canLike instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = [values.canLike]; - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; + } else { + throw new TypeError( + \\"The canLike must be of type \\" + + \\"InteractionRule\\" + \\".\\", + ); + } } + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + if (\\"canReply\\" in values && values.canReply != null) { + if (values.canReply instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = [values.canReply]; - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; + } else { + throw new TypeError( + \\"The canReply must be of type \\" + + \\"InteractionRule\\" + \\".\\", + ); + } } + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + if (\\"canAnnounce\\" in values && values.canAnnounce != null) { + if (values.canAnnounce instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = [values.canAnnounce]; - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Service\\"].join(\\", \\")); - } - - - /** - * Similar to - * {@link Activity.getActor}, - * but returns its \`@id\` URL instead of the object itself. - */ - get actorId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + } else { + throw new TypeError( + \\"The canAnnounce must be of type \\" + + \\"InteractionRule\\" + \\".\\", + ); + } } - if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; - const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - if (v instanceof URL) return v; - return v.id; - } -/** Describes one or more entities that either performed or are expected to - * perform the activity. Any single activity can have multiple actors. - * The actor MAY be specified using an indirect {@link Link}. + return clone; + } + +/** The sub-policy specifying who can like the post. + * + * When absent, implementations should assume that anyone can like the post + * (i.e., \`automaticApproval\` defaults to the public collection). * */ - - async getActor( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { + get canLike(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; - let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) return null; - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"actor\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"actor\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#actor_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; + if (this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length < 1) return null; + return this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[0]; } - /** - * Similar to - * {@link Activity.getActors}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get actorIds(): URL[] { +/** The sub-policy specifying who can reply to the post. + * + * When absent, implementations should assume that anyone can reply + * (i.e., \`automaticApproval\` defaults to the public collection). + * + */ + get canReply(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + if (this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length < 1) return null; + return this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[0]; } -/** Describes one or more entities that either performed or are expected to - * perform the activity. Any single activity can have multiple actors. - * The actor MAY be specified using an indirect {@link Link}. +/** The sub-policy specifying who can announce (boost) the post. + * + * When absent, implementations should assume that anyone can announce + * (i.e., \`automaticApproval\` defaults to the public collection). * */ - - async* getActors( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { + get canAnnounce(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"actor\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"actor\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#actor_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } + if (this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length < 1) return null; + return this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[0]; } - async #fetchObject( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#canLike\\"] = propValue; + + } + + array = []; + for (const v of this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#canReply\\"] = propValue; + + } + + array = []; + for (const v of this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#canAnnounce\\"] = propValue; + + } + + + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + \\"https://gotosocial.org/ns\\"; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + if ( + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike != null && + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length > 0 + ) return false; + + if ( + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply != null && + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length > 0 + ) return false; + + if ( + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce != null && + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length > 0 + ) return false; + + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { try { - fetchResult = await documentLoader(url.href); + const object = await this.__fromJsonLd__InteractionPolicy__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; } catch (error) { span.setStatus({ code: SpanStatusCode.ERROR, message: String(error), }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#object_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; } finally { span.end(); } + }, + ); + } + + protected static async __fromJsonLd__InteractionPolicy__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#InteractionPolicy\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } + } + + const instance = new this( + { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + options, + ); + const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; - async #object_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; + let _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array = values[\\"https://gotosocial.org/ns#canLike\\"]; - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + for ( + const v of _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array == null + ? [] + : _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array.length === 1 && \\"@list\\" in _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array[0] + ? _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array[0][\\"@list\\"] + : _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array + ) { + if (v == null) continue; + _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + const _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply: (InteractionRule)[] = []; + + let _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array = values[\\"https://gotosocial.org/ns#canReply\\"]; + + for ( + const v of _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array == null + ? [] + : _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array.length === 1 && \\"@list\\" in _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array[0] + ? _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array[0][\\"@list\\"] + : _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array + ) { + if (v == null) continue; + _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) } + instance.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + const _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce: (InteractionRule)[] = []; + let _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array = values[\\"https://gotosocial.org/ns#canAnnounce\\"]; - /** - * Similar to - * {@link Activity.getObject}, - * but returns its \`@id\` URL instead of the object itself. - */ - get objectId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; - const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - if (v instanceof URL) return v; - return v.id; + for ( + const v of _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array == null + ? [] + : _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array.length === 1 && \\"@list\\" in _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array[0] + ? _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array[0][\\"@list\\"] + : _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array + ) { + if (v == null) continue; + _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) + } + instance.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } + + const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length == 1) { + proxy.canLike = _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[0]; } -/** When used within an {@link Activity}, describes the direct object of - * the activity. For instance, in the activity \\"John added a movie to his - * wishlist\\", the object of the activity is the movie added. - * - */ - - async getObject( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; - let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) return null; - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"object\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"object\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#object_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; + const _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length == 1) { + proxy.canReply = _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[0]; } - /** - * Similar to - * {@link Activity.getObjects}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get objectIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + const _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length == 1) { + proxy.canAnnounce = _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[0]; } -/** When used within an {@link Activity}, describes the direct object of - * the activity. For instance, in the activity \\"John added a movie to his - * wishlist\\", the object of the activity is the movie added. + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(InteractionPolicy.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: InteractionPolicy, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionPolicy \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(InteractionPolicy.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: InteractionPolicy, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionPolicy \\" + inspect(proxy, options); + }; + /** Represents a sub-policy within an {@link InteractionPolicy}, defining which + * actors receive automatic or manual approval for a specific interaction type + * (like, reply, or announce). + * + * Valid values in the approval lists include: + * + * - The ActivityStreams public collection + * (\`https://www.w3.org/ns/activitystreams#Public\`) for anyone + * - The post author's \`followers\` or \`following\` collection URIs + * - Individual actor URIs + * + * When an actor appears in both \`automaticApproval\` and \`manualApproval\`, + * the more specific value takes precedence (individual URI overrides + * collection membership), and \`automaticApproval\` takes precedence over + * \`manualApproval\` for identical URIs. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ +export class InteractionRule { - async* getObjects( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link InteractionRule}: \`https://gotosocial.org/ns#InteractionRule\`. + */ + static get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#InteractionRule\\"); + } + #_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; +#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval: (URL)[] = []; + + /** + * Constructs a new instance of InteractionRule with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if (\\"$warning\\" in options) { + this.#warning = options.$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError(\\"The id must be a URL.\\"); + } + + if (\\"automaticApproval\\" in values && values.automaticApproval != null) { + if (values.automaticApproval instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = [values.automaticApproval]; - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"object\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"object\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#object_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } else { + throw new TypeError( + \\"The automaticApproval must be of type \\" + + \\"URL\\" + \\".\\", ); - continue; } - yield v; } - } - async #fetchTarget( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } - throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#target_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, + if (\\"automaticApprovals\\" in values && values.automaticApprovals != null) { + + if (\\"automaticApproval\\" in values && + values.automaticApproval != null) { + throw new TypeError( + \\"Cannot initialize both automaticApproval and \\" + + \\"automaticApprovals at the same time.\\", ); - return null; } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } + + if (Array.isArray(values.automaticApprovals) && + values.automaticApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals; + + } else { + throw new TypeError( + \\"The automaticApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", ); - return null; } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); - } - }); - } - - async #target_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; } - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); - } - - - /** - * Similar to - * {@link Activity.getTarget}, - * but returns its \`@id\` URL instead of the object itself. - */ - get targetId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if (\\"manualApproval\\" in values && values.manualApproval != null) { + if (values.manualApproval instanceof URL) { + // @ts-ignore: type is checked above. + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = [values.manualApproval]; + + } else { + throw new TypeError( + \\"The manualApproval must be of type \\" + + \\"URL\\" + \\".\\", + ); + } } - if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; - const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - if (v instanceof URL) return v; - return v.id; - } -/** Describes the indirect object, or target, of the activity. The precise - * meaning of the target is largely dependent on the type of action being - * described but will often be the object of the English preposition \\"to\\". - * For instance, in the activity \\"John added a movie to his wishlist\\", - * the target of the activity is John's wishlist. An activity can have more - * than one target. - * - */ - - async getTarget( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if (\\"manualApprovals\\" in values && values.manualApprovals != null) { + + if (\\"manualApproval\\" in values && + values.manualApproval != null) { + throw new TypeError( + \\"Cannot initialize both manualApproval and \\" + + \\"manualApprovals at the same time.\\", + ); + } + + if (Array.isArray(values.manualApprovals) && + values.manualApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals; + + } else { + throw new TypeError( + \\"The manualApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", + ); + } } - if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; - let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - v = v.id; + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + clone( + values: + { +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): InteractionRule { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: InteractionRule = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + if (\\"automaticApproval\\" in values && values.automaticApproval != null) { + if (values.automaticApproval instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = [values.automaticApproval]; + + } else { + throw new TypeError( + \\"The automaticApproval must be of type \\" + + \\"URL\\" + \\".\\", + ); + } } - if (v instanceof URL) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) return null; - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); - this._cachedJsonLd = undefined; - return fetched; + + if (\\"automaticApprovals\\" in values && values.automaticApprovals != null) { + + if (\\"automaticApproval\\" in values && + values.automaticApproval != null) { + throw new TypeError( + \\"Cannot update both automaticApproval and \\" + + \\"automaticApprovals at the same time.\\", + ); + } + + if (Array.isArray(values.automaticApprovals) && + values.automaticApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals; + + } else { + throw new TypeError( + \\"The automaticApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", + ); + } } + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + if (\\"manualApproval\\" in values && values.manualApproval != null) { + if (values.manualApproval instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = [values.manualApproval]; - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"target\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"target\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#target_fromJsonLd(doc, options); + } else { + throw new TypeError( + \\"The manualApproval must be of type \\" + + \\"URL\\" + \\".\\", + ); } } + + if (\\"manualApprovals\\" in values && values.manualApprovals != null) { + + if (\\"manualApproval\\" in values && + values.manualApproval != null) { + throw new TypeError( + \\"Cannot update both manualApproval and \\" + + \\"manualApprovals at the same time.\\", + ); + } - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' + if (Array.isArray(values.manualApprovals) && + values.manualApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals; + + } else { + throw new TypeError( + \\"The manualApprovals must be an array of type \\" + + \\"URL\\" + \\".\\", ); } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; } - return v; - } - /** - * Similar to - * {@link Activity.getTargets}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get targetIds(): URL[] { + return clone; + } + +/** URIs of actors or collections whose interactions are automatically + * approved without requiring manual review by the post author. + * + */ + get automaticApproval(): (URL | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + if (this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < 1) return null; + return this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[0]; } -/** Describes the indirect object, or target, of the activity. The precise - * meaning of the target is largely dependent on the type of action being - * described but will often be the object of the English preposition \\"to\\". - * For instance, in the activity \\"John added a movie to his wishlist\\", - * the target of the activity is John's wishlist. An activity can have more - * than one target. +/** URIs of actors or collections whose interactions are automatically + * approved without requiring manual review by the post author. * */ - - async* getTargets( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { +get automaticApprovals(): (URL)[] { + return this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + } + +/** URIs of actors or collections whose interactions require manual approval + * by the post author. The post author can accept or reject these + * interactions at their discretion. + * + */ + get manualApproval(): (URL | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } + if (this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length < 1) return null; + return this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[0]; + } - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"target\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"target\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#target_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } +/** URIs of actors or collections whose interactions require manual approval + * by the post author. The post author can accept or reject these + * interactions at their discretion. + * + */ +get manualApprovals(): (URL)[] { + return this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; } - async #fetchResult( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" ); - return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { - let fetchResult: RemoteDocument; + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + const element = ( + { \\"@id\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#automaticApproval\\"] = propValue; + + } + + array = []; + for (const v of this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + const element = ( + { \\"@id\\": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values[\\"https://gotosocial.org/ns#manualApproval\\"] = propValue; + + } + + + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + \\"https://gotosocial.org/ns\\"; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { try { - fetchResult = await documentLoader(url.href); + const object = await this.__fromJsonLd__InteractionRule__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; } catch (error) { span.setStatus({ code: SpanStatusCode.ERROR, message: String(error), }); - span.end(); - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to fetch {url}: {error}\\", - { error, url: url.href } - ); - return null; - } throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#result_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== \\"trust\\" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + - \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); - span.setAttribute( - \\"activitypub.object.type\\", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger([\\"fedify\\", \\"vocab\\"]).error( - \\"Failed to parse {url}: {error}\\", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; } finally { span.end(); } + }, + ); + } + + protected static async __fromJsonLd__InteractionRule__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#InteractionRule\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + const instance = new this( + { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + options, + ); + const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; + + let _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array = values[\\"https://gotosocial.org/ns#automaticApproval\\"]; + + for ( + const v of _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array == null + ? [] + : _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array.length === 1 && \\"@list\\" in _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array[0] + ? _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array[0][\\"@list\\"] + : _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array + ) { + if (v == null) continue; + _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.push(v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + + encodeURIComponent( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(5, v[\\"@id\\"].indexOf(\\"/\\", 5)) + : v[\\"@id\\"].slice(5) + ) + + ( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(v[\\"@id\\"].indexOf(\\"/\\", 5)) + : \\"\\" + ) + ) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + ? new URL(v[\\"@id\\"]) + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])))) } + instance.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + const _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval: (URL)[] = []; - async #result_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL + let _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array = values[\\"https://gotosocial.org/ns#manualApproval\\"]; + + for ( + const v of _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array == null + ? [] + : _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array.length === 1 && \\"@list\\" in _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array[0] + ? _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array[0][\\"@list\\"] + : _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array + ) { + if (v == null) continue; + _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.push(v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + + encodeURIComponent( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(5, v[\\"@id\\"].indexOf(\\"/\\", 5)) + : v[\\"@id\\"].slice(5) + ) + + ( + v[\\"@id\\"].includes(\\"/\\", 5) + ? v[\\"@id\\"].slice(v[\\"@id\\"].indexOf(\\"/\\", 5)) + : \\"\\" + ) + ) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + ? new URL(v[\\"@id\\"]) + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])))) + } + instance.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(this.id!.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(this.id!.href, options), + }; + } - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } + const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); + + if (_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length == 1) { + proxy.automaticApproval = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[0]; + } - throw new TypeError(\\"Expected an object of any type of: \\" + - [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); - } - + if (_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length > 1 + || !(\\"automaticApproval\\" in proxy) + && _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length > 0) { + proxy.automaticApprovals = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + } + + const _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for(\\"Deno.customInspect\\")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => \\"URL \\" + inspect(v.href, options), + [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => \\"URL \\" + inspect(v.href, options), + } + : v); - /** - * Similar to - * {@link Activity.getResult}, - * but returns its \`@id\` URL instead of the object itself. - */ - get resultId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; - const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - if (v instanceof URL) return v; - return v.id; + if (_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length == 1) { + proxy.manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[0]; } -/** Describes the result of the activity. For instance, if a particular action - * results in the creation of a new resource, the result property can be used - * to describe that new resource. + if (_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length > 1 + || !(\\"manualApproval\\" in proxy) + && _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length > 0) { + proxy.manualApprovals = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(InteractionRule.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: InteractionRule, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionRule \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(InteractionRule.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: InteractionRule, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"InteractionRule \\" + inspect(proxy, options); + }; + /** Proves that a {@link Like} interaction has been approved by the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that a like was authorized. The \`attributedTo\` property identifies + * the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ +export class LikeAuthorization extends Object { - async getResult( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; - let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) return null; - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"result\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"result\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#result_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' + /** + * The type URI of {@link LikeAuthorization}: \`https://gotosocial.org/ns#LikeApproval\`. + */ + static override get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#LikeApproval\\"); + } + + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + /** + * Constructs a new instance of LikeAuthorization with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; } - return v; - } - /** - * Similar to - * {@link Activity.getResults}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get resultIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); + } } - return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); } - -/** Describes the result of the activity. For instance, if a particular action - * results in the creation of a new resource, the result property can be used - * to describe that new resource. - * - */ - async* getResults( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"result\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"result\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#result_fromJsonLd(obj, options); - } + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): LikeAuthorization { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + } else { + throw new TypeError( + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", + ); } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + } else { + throw new TypeError( + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", ); - continue; } - yield v; } - } - async #fetchOrigin( + return clone; + } + + async #fetchInteractingObject( url: URL, options: { documentLoader?: DocumentLoader, @@ -13930,7 +20419,7 @@ instruments?: (Object | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#origin_fromJsonLd( + const obj = await this.#interactingObject_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -13979,7 +20468,7 @@ instruments?: (Object | URL)[];} }); } - async #origin_fromJsonLd( + async #interactingObject_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -14012,30 +20501,28 @@ instruments?: (Object | URL)[];} /** * Similar to - * {@link Activity.getOrigin}, + * {@link LikeAuthorization.getInteractingObject}, * but returns its \`@id\` URL instead of the object itself. */ - get originId(): URL | null { + get interactingObjectId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; - const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (v instanceof URL) return v; return v.id; } -/** Describes an indirect object of the activity from which the activity is - * directed. The precise meaning of the origin is the object of the English - * preposition \\"from\\". For instance, in the activity \\"John moved an item to - * List B from List A\\", the origin of the activity is \\"List A\\". +/** The URI of the interaction (e.g., a {@link Like} activity) that + * has been authorized. * */ - async getOrigin( + async getInteractingObject( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -14050,161 +20537,63 @@ instruments?: (Object | URL)[];} this._warning.values ); } - if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; - let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { v = v.id; } if (v instanceof URL) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) return null; - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"origin\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"origin\\"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#origin_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; - } - - /** - * Similar to - * {@link Activity.getOrigins}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get originIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Describes an indirect object of the activity from which the activity is - * directed. The precise meaning of the origin is the object of the English - * preposition \\"from\\". For instance, in the activity \\"John moved an item to - * List B from List A\\", the origin of the activity is \\"List A\\". - * - */ - - async* getOrigins( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; } - const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"origin\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"origin\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#origin_fromJsonLd(obj, options); - } + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactingObject\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactingObject\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); } + } - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' ); - continue; } - yield v; + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; } + return v; } - async #fetchInstrument( + async #fetchInteractionTarget( url: URL, options: { documentLoader?: DocumentLoader, @@ -14246,7 +20635,7 @@ instruments?: (Object | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#instrument_fromJsonLd( + const obj = await this.#interactionTarget_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -14295,7 +20684,7 @@ instruments?: (Object | URL)[];} }); } - async #instrument_fromJsonLd( + async #interactionTarget_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -14328,28 +20717,27 @@ instruments?: (Object | URL)[];} /** * Similar to - * {@link Activity.getInstrument}, + * {@link LikeAuthorization.getInteractionTarget}, * but returns its \`@id\` URL instead of the object itself. */ - get instrumentId(): URL | null { + get interactionTargetId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; - const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (v instanceof URL) return v; return v.id; } -/** Identifies one or more objects used (or to be used) in the completion of - * an {@link Activity}. +/** The URI of the post that is the target of the authorized interaction. * */ - async getInstrument( + async getInteractionTarget( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -14364,19 +20752,19 @@ instruments?: (Object | URL)[];} this._warning.values ); } - if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; - let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchInstrument(v, options); + await this.#fetchInteractionTarget(v, options); if (fetched == null) return null; - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); this._cachedJsonLd = undefined; return fetched; } @@ -14385,19 +20773,19 @@ instruments?: (Object | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === \\"object\\" && \\"@context\\" in this._cachedJsonLd && - \\"instrument\\" in this._cachedJsonLd + \\"interactionTarget\\" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - \\"instrument\\"]; + \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#instrument_fromJsonLd(doc, options); + v = await this.#interactionTarget_fromJsonLd(doc, options); } } if (options.crossOrigin !== \\"trust\\" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -14420,102 +20808,6 @@ instruments?: (Object | URL)[];} return v; } - /** - * Similar to - * {@link Activity.getInstruments}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get instrumentIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies one or more objects used (or to be used) in the completion of - * an {@link Activity}. - * - */ - - async* getInstruments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchInstrument(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === \\"object\\" && - \\"@context\\" in this._cachedJsonLd && - \\"instrument\\" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - \\"instrument\\"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#instrument_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== \\"trust\\" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { - if (options.crossOrigin === \\"throw\\") { - throw new Error( - \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + - \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + - \\"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\\".' - ); - } - getLogger([\\"fedify\\", \\"vocab\\"]).warn( - \\"The property object's @id ({objectId}) has a different origin \\" + - \\"than the property owner's @id ({parentObjectId}); 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\\".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -14545,6 +20837,63 @@ instruments?: (Object | URL)[];} contextLoader: options.contextLoader ?? getDocumentLoader(), }; + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactingObject\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result[\\"interactionTarget\\"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result[\\"type\\"] = \\"LikeAuthorization\\"; + if (this.id != null) result[\\"id\\"] = this.id.href; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; + return result; + } + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; @@ -14559,67 +20908,7 @@ instruments?: (Object | URL)[];} >; array = []; - for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#actor\\"] = propValue; - - } - - array = []; - for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#object\\"] = propValue; - - } - - array = []; - for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#target\\"] = propValue; - - } - - array = []; - for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { - const element = ( - v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values[\\"https://www.w3.org/ns/activitystreams#result\\"] = propValue; - - } - - array = []; - for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const element = ( v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); @@ -14629,12 +20918,12 @@ instruments?: (Object | URL)[];} const propValue = ( array ); - values[\\"https://www.w3.org/ns/activitystreams#origin\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactingObject\\"] = propValue; } array = []; - for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const element = ( v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); @@ -14644,11 +20933,11 @@ instruments?: (Object | URL)[];} const propValue = ( array ); - values[\\"https://www.w3.org/ns/activitystreams#instrument\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactionTarget\\"] = propValue; } - values[\\"@type\\"] = [\\"https://www.w3.org/ns/activitystreams#Activity\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#LikeApproval\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -14657,7 +20946,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -14690,214 +20979,94 @@ instruments?: (Object | URL)[];} * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. * @param options The options to use. - * - \`documentLoader\`: The loader for remote JSON-LD documents. - * - \`contextLoader\`: The loader for remote JSON-LD contexts. - * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. - * If omitted, the global tracer provider is used. - * @returns The object of this type. - * @throws {TypeError} If the given \`json\` is invalid. - */ - static override async fromJsonLd( - json: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL, - } = {}, - ): Promise { - const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - \\"@fedify/vocab-tools\\", - \\"0.0.0\\", - ); - return await tracer.startActiveSpan( - \\"activitypub.parse_object\\", - async (span) => { - try { - const object = await this.__fromJsonLd__Activity__( - json, span, options); - if (object.id != null) { - span.setAttribute(\\"activitypub.object.id\\", object.id.href); - } - return object; - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - throw error; - } finally { - span.end(); - } - }, - ); - } - - protected static async __fromJsonLd__Activity__( - json: unknown, - span: Span, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL, - } = {}, - ): Promise { - if (typeof json === \\"undefined\\") { - throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); - } - else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); - options = { - ...options, - documentLoader: options.documentLoader ?? getDocumentLoader(), - contextLoader: options.contextLoader ?? getDocumentLoader(), - tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), - }; - // deno-lint-ignore no-explicit-any - let values: Record & { \\"@id\\"?: string }; - if (globalThis.Object.keys(json).length == 0) { - values = {}; - } else { - const expanded = await jsonld.expand(json, { - documentLoader: options.contextLoader, - keepFreeFloatingNodes: true, - }); - values = - // deno-lint-ignore no-explicit-any - (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); - } - if (options.baseUrl == null && values[\\"@id\\"] != null) { - options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; - } - - if (\\"@type\\" in values) { - span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); - } - if (\\"@type\\" in values && - !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - - if (values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { - return await EmojiReact.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Accept\\")) { - return await Accept.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\")) { - return await TentativeAccept.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Add\\")) { - return await Add.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Announce\\")) { - return await Announce.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Create\\")) { - return await Create.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Delete\\")) { - return await Delete.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Dislike\\")) { - return await Dislike.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Flag\\")) { - return await Flag.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Follow\\")) { - return await Follow.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Ignore\\")) { - return await Ignore.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Block\\")) { - return await Block.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\")) { - return await IntransitiveActivity.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Arrive\\")) { - return await Arrive.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Question\\")) { - return await Question.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Travel\\")) { - return await Travel.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Join\\")) { - return await Join.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Leave\\")) { - return await Leave.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Like\\")) { - return await Like.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Listen\\")) { - return await Listen.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Move\\")) { - return await Move.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Offer\\")) { - return await Offer.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Invite\\")) { - return await Invite.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Read\\")) { - return await Read.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Reject\\")) { - return await Reject.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#TentativeReject\\")) { - return await TentativeReject.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Remove\\")) { - return await Remove.fromJsonLd(json, options); - } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Undo\\")) { - return await Undo.fromJsonLd(json, options); + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__LikeAuthorization__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__LikeAuthorization__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Update\\")) { - return await Update.fromJsonLd(json, options); + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - - if (values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#View\\")) { - return await View.fromJsonLd(json, options); + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } - - if (!values[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Activity\\")) { + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeApproval\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -14908,212 +21077,69 @@ instruments?: (Object | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof Activity)) { + if (!(instance instanceof LikeAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); - - let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values[\\"https://www.w3.org/ns/activitystreams#actor\\"]; - - for ( - const v of _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array == null - ? [] - : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array.length === 1 && \\"@list\\" in _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0] - ? _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0][\\"@list\\"] - : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - - const decoded = - typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - ) : undefined - ; - if (typeof decoded === \\"undefined\\") continue; - _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); - - } - instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - - const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); - - let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; - - for ( - const v of _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array == null - ? [] - : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array.length === 1 && \\"@list\\" in _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0] - ? _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0][\\"@list\\"] - : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - )) - } - instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - - const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); - - let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values[\\"https://www.w3.org/ns/activitystreams#target\\"]; - - for ( - const v of _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array == null - ? [] - : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array.length === 1 && \\"@list\\" in _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0] - ? _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0][\\"@list\\"] - : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - )) - } - instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - - const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); - - let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values[\\"https://www.w3.org/ns/activitystreams#result\\"]; - - for ( - const v of _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array == null - ? [] - : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array.length === 1 && \\"@list\\" in _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0] - ? _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0][\\"@list\\"] - : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array - ) { - if (v == null) continue; - - if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) - && globalThis.Object.keys(v).length === 1) { - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( - !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") - ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) - : new URL(v[\\"@id\\"]) - ); - continue; - } - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } - )) - } - instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - - const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); - let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values[\\"https://www.w3.org/ns/activitystreams#origin\\"]; + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; for ( - const v of _25zu2s3VxVujgEKqrDycjE284XQR_origin__array == null + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] - : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array.length === 1 && \\"@list\\" in _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0] - ? _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0][\\"@list\\"] - : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && \\"@list\\" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0][\\"@list\\"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array ) { if (v == null) continue; if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) : new URL(v[\\"@id\\"]) ); continue; } - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } )) } - instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; - const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); - let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values[\\"https://www.w3.org/ns/activitystreams#instrument\\"]; + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; for ( - const v of _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array == null + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] - : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array.length === 1 && \\"@list\\" in _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0] - ? _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0][\\"@list\\"] - : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && \\"@list\\" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0][\\"@list\\"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array ) { if (v == null) continue; if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) : new URL(v[\\"@id\\"]) ); continue; } - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } )) } - instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -15130,111 +21156,7 @@ instruments?: (Object | URL)[];} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length == 1) { - proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - } - - if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 1 - || !(\\"actor\\" in proxy) - && _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 0) { - proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - } - - const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length == 1) { - proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - } - - if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 1 - || !(\\"object\\" in proxy) - && _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 0) { - proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - } - - const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length == 1) { - proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - } - - if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 1 - || !(\\"target\\" in proxy) - && _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 0) { - proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - } - - const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(v.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(v.href, options), - } - : v); - - if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length == 1) { - proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - } - - if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 1 - || !(\\"result\\" in proxy) - && _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 0) { - proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - } - - const _25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -15250,17 +21172,11 @@ instruments?: (Object | URL)[];} } : v); - if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length == 1) { - proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; - } - - if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 1 - || !(\\"origin\\" in proxy) - && _25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 0) { - proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; } - const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -15276,14 +21192,8 @@ instruments?: (Object | URL)[];} } : v); - if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length == 1) { - proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; - } - - if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 1 - || !(\\"instrument\\" in proxy) - && _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 0) { - proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; } return proxy; @@ -15292,41 +21202,50 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any -(Activity.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(LikeAuthorization.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: Activity, + this: LikeAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Activity \\" + inspect(proxy, options); + return \\"LikeAuthorization \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Activity.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(LikeAuthorization.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: Activity, + this: LikeAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"Activity \\" + inspect(proxy, options); + return \\"LikeAuthorization \\" + inspect(proxy, options); }; - /** Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0). + /** A request to like a post that requires approval from the post author. + * + * The \`object\` property references the post to be liked, and + * the \`instrument\` property contains the {@link Like} activity itself. + * + * The post author responds with an {@link Accept} (with a + * {@link LikeAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class EmojiReact extends Activity { +export class LikeRequest extends Activity { /** - * The type URI of {@link EmojiReact}: \`http://litepub.social/ns#EmojiReact\`. + * The type URI of {@link LikeRequest}: \`https://gotosocial.org/ns#LikeRequest\`. */ static override get typeId(): URL { - return new URL(\\"http://litepub.social/ns#EmojiReact\\"); + return new URL(\\"https://gotosocial.org/ns#LikeRequest\\"); } /** - * Constructs a new instance of EmojiReact with the given values. + * Constructs a new instance of LikeRequest with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -15350,7 +21269,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -15392,7 +21311,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -15405,7 +21324,7 @@ instruments?: (Object | URL)[];} documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): EmojiReact { + ): LikeRequest { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -15414,7 +21333,7 @@ instruments?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as EmojiReact; + const clone = super.clone(values, options) as unknown as LikeRequest; return clone; } @@ -15460,7 +21379,7 @@ instruments?: (Object | URL)[];} unknown[] | { \\"@list\\": unknown[] } | string >; - values[\\"@type\\"] = [\\"http://litepub.social/ns#EmojiReact\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#LikeRequest\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -15469,7 +21388,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -15517,7 +21436,7 @@ instruments?: (Object | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -15527,7 +21446,7 @@ instruments?: (Object | URL)[];} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__EmojiReact__( + const object = await this.__fromJsonLd__LikeRequest__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -15546,7 +21465,7 @@ instruments?: (Object | URL)[];} ); } - protected static async __fromJsonLd__EmojiReact__( + protected static async __fromJsonLd__LikeRequest__( json: unknown, span: Span, options: { @@ -15555,7 +21474,7 @@ instruments?: (Object | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -15589,7 +21508,7 @@ instruments?: (Object | URL)[];} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://litepub.social/ns#EmojiReact\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#LikeRequest\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } @@ -15600,7 +21519,7 @@ instruments?: (Object | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof EmojiReact)) { + if (!(instance instanceof LikeRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); } @@ -15625,81 +21544,54 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any -(EmojiReact.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(LikeRequest.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: EmojiReact, + this: LikeRequest, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"EmojiReact \\" + inspect(proxy, options); + return \\"LikeRequest \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(EmojiReact.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(LikeRequest.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: EmojiReact, + this: LikeRequest, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"EmojiReact \\" + inspect(proxy, options); + return \\"LikeRequest \\" + inspect(proxy, options); }; - /** A pair of property name and value. + /** Proves that a reply interaction has been approved by the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that a reply was authorized. The \`attributedTo\` property identifies + * the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * */ -export class PropertyValue { - - readonly #documentLoader?: DocumentLoader; - readonly #contextLoader?: DocumentLoader; - readonly #tracerProvider?: TracerProvider; - readonly #warning?: { - category: string[]; - message: string; - values?: Record; - }; - #cachedJsonLd?: unknown; - readonly id: URL | null; - - protected get _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } - - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } - - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } - - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } - - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } +export class ReplyAuthorization extends Object { - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - /** - * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. + * The type URI of {@link ReplyAuthorization}: \`https://gotosocial.org/ns#ReplyAuthorization\`. */ - static get typeId(): URL { - return new URL(\\"http://schema.org#PropertyValue\\"); + static override get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#ReplyAuthorization\\"); } - #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; -#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; - + + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + /** - * Constructs a new instance of PropertyValue with the given values. + * Constructs a new instance of ReplyAuthorization with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -15707,7 +21599,23 @@ export class PropertyValue { values: { id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -15715,45 +21623,29 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, } = {}, ) { - - this.#documentLoader = options.documentLoader; - this.#contextLoader = options.contextLoader; - this.#tracerProvider = options.tracerProvider; - if (\\"$warning\\" in options) { - this.#warning = options.$warning as unknown as { - category: string[]; - message: string; - values?: Record; - }; - } - if (values.id == null || values.id instanceof URL) { - this.id = values.id ?? null; - } else { - throw new TypeError(\\"The id must be a URL.\\"); - } - - if (\\"name\\" in values && values.name != null) { - if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + super(values, options); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; - + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); } else { throw new TypeError( - \\"The name must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } - if (\\"value\\" in values && values.value != null) { - if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; - + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); } else { throw new TypeError( - \\"The value must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } @@ -15765,18 +21657,34 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @param options The options to use for cloning. * @returns The cloned instance. */ - clone( + override clone( values: { id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): PropertyValue { + ): ReplyAuthorization { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -15785,35 +21693,29 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - - // @ts-ignore: this.constructor is not recognized as a constructor, but it is. - const clone: PropertyValue = new this.constructor( - { id: values.id ?? this.id }, - options - ); - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - if (\\"name\\" in values && values.name != null) { - if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { + const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if (\\"interactingObject\\" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; - + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); } else { throw new TypeError( - \\"The name must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactingObject must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - if (\\"value\\" in values && values.value != null) { - if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if (\\"interactionTarget\\" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; - + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); } else { throw new TypeError( - \\"The value must be of type \\" + - \\"string | LanguageString\\" + \\".\\", + \\"The interactionTarget must be of type \\" + + \\"Object | URL\\" + \\".\\", ); } } @@ -15821,30 +21723,435 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return clone; } -/** The name of a property. + async #fetchInteractingObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactingObject_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactingObject_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link ReplyAuthorization.getInteractingObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactingObjectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the reply object (e.g., a {@link Note}) that has been + * authorized. + * */ - get name(): (string | LanguageString | null) { + + async getInteractingObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) return null; - return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactingObject\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactingObject\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } -/** The value of a property. + async #fetchInteractionTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan(\\"activitypub.lookup_object\\", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to fetch {url}: {error}\\", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactionTarget_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== \\"trust\\" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The object's @id (\\" + obj.id.href + \\") has a different origin \\" + + \\"than the document URL (\\" + baseUrl.href + \\"); 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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).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\\".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute(\\"activitypub.object.id\\", (obj.id ?? url).href); + span.setAttribute( + \\"activitypub.object.type\\", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger([\\"fedify\\", \\"vocab\\"]).error( + \\"Failed to parse {url}: {error}\\", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactionTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError(\\"Expected an object of any type of: \\" + + [\\"https://www.w3.org/ns/activitystreams#Object\\"].join(\\", \\")); + } + + + /** + * Similar to + * {@link ReplyAuthorization.getInteractionTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactionTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the post that is the target of the authorized reply. + * */ - get value(): (string | LanguageString | null) { + + async getInteractionTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: \\"ignore\\" | \\"throw\\" | \\"trust\\"; + } = {} + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1) return null; - return this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (options.crossOrigin !== \\"trust\\" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractionTarget(v, options); + if (fetched == null) return null; + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === \\"object\\" && + \\"@context\\" in this._cachedJsonLd && + \\"interactionTarget\\" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + \\"interactionTarget\\"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { + v = await this.#interactionTarget_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== \\"trust\\" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + if (options.crossOrigin === \\"throw\\") { + throw new Error( + \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + + \\"origin than the property owner's @id (\\" + this.id.href + \\"); \\" + + \\"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\\".' + ); + } + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"The property object's @id ({objectId}) has a different origin \\" + + \\"than the property owner's @id ({parentObjectId}); 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\\".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } /** @@ -15857,7 +22164,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} when \`format\` is set to \`'expand'\`. * @returns The JSON-LD representation of this object. */ - async toJsonLd(options: { + override async toJsonLd(options: { format?: \\"compact\\" | \\"expand\\", contextLoader?: DocumentLoader, context?: string | Record | (string | Record)[], @@ -15877,23 +22184,30 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} }; if (options.format == null && this.isCompactable()) { - const result: Record = {}; + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + // deno-lint-ignore no-unused-vars let compactItems: unknown[]; compactItems = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) ); compactItems.push(item); } if (compactItems.length > 0) { - result[\\"name\\"] + result[\\"interactingObject\\"] = compactItems.length > 1 ? compactItems : compactItems[0]; @@ -15901,40 +22215,48 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } compactItems = []; - for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const item = ( - typeof v === \\"string\\" ? v : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) ); compactItems.push(item); } if (compactItems.length > 0) { - result[\\"value\\"] + result[\\"interactionTarget\\"] = compactItems.length > 1 ? compactItems : compactItems[0]; } - result[\\"type\\"] = \\"PropertyValue\\"; + result[\\"type\\"] = \\"ReplyAuthorization\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + array = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const element = ( - typeof v === \\"string\\" ? { \\"@value\\": v } : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); array.push(element);; } @@ -15942,17 +22264,14 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const propValue = ( array ); - values[\\"https://www.w3.org/ns/activitystreams#name\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactingObject\\"] = propValue; } array = []; - for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const element = ( - typeof v === \\"string\\" ? { \\"@value\\": v } : { - \\"@value\\": v.toString(), - \\"@language\\": v.locale.baseName, - } + v instanceof URL ? { \\"@id\\": v.href } : await v.toJsonLd(options) ); array.push(element);; } @@ -15960,11 +22279,11 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const propValue = ( array ); - values[\\"http://schema.org#value\\"] = propValue; + values[\\"https://gotosocial.org/ns#interactionTarget\\"] = propValue; } - values[\\"@type\\"] = [\\"http://schema.org#PropertyValue\\"]; + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#ReplyAuthorization\\"]; if (this.id != null) values[\\"@id\\"] = this.id.href; if (options.format === \\"expand\\") { return await jsonld.expand( @@ -15973,7 +22292,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",{\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -15982,23 +22301,24 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} if (docContext != null) { // Embed context + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + } return compacted; } - protected isCompactable(): boolean { + protected override isCompactable(): boolean { - if ( - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 - ) return false; - - if ( - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null && - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0 - ) return false; - - return true; + return super.isCompactable(); } /** @@ -16012,7 +22332,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @returns The object of this type. * @throws {TypeError} If the given \`json\` is invalid. */ - static async fromJsonLd( + static override async fromJsonLd( json: unknown, options: { documentLoader?: DocumentLoader, @@ -16020,7 +22340,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( \\"@fedify/vocab-tools\\", @@ -16030,7 +22350,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} \\"activitypub.parse_object\\", async (span) => { try { - const object = await this.__fromJsonLd__PropertyValue__( + const object = await this.__fromJsonLd__ReplyAuthorization__( json, span, options); if (object.id != null) { span.setAttribute(\\"activitypub.object.id\\", object.id.href); @@ -16049,7 +22369,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } - protected static async __fromJsonLd__PropertyValue__( + protected static async __fromJsonLd__ReplyAuthorization__( json: unknown, span: Span, options: { @@ -16058,7 +22378,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === \\"undefined\\") { throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); } @@ -16092,63 +22412,80 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} if (\\"@type\\" in values && !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { - if (!values[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\")) { + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyAuthorization\\")) { throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); } } - const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, - options, - ); - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; - - let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values[\\"https://www.w3.org/ns/activitystreams#name\\"]; + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ReplyAuthorization)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; for ( - const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && \\"@list\\" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] - ? _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0][\\"@list\\"] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && \\"@list\\" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0][\\"@list\\"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array ) { if (v == null) continue; - const decoded = - typeof v === \\"object\\" && \\"@value\\" in v - && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v - && typeof v[\\"@language\\"] === \\"string\\" - && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined - ; - if (typeof decoded === \\"undefined\\") continue; - _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.push(decoded); - + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) } - instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; - - let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values[\\"http://schema.org#value\\"]; + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; for ( - const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && \\"@list\\" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] - ? _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0][\\"@list\\"] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && \\"@list\\" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0][\\"@list\\"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array ) { if (v == null) continue; - const decoded = - typeof v === \\"object\\" && \\"@value\\" in v - && typeof v[\\"@value\\"] === \\"string\\" && !(\\"@language\\" in v) ? v[\\"@value\\"] : typeof v === \\"object\\" && \\"@language\\" in v && \\"@value\\" in v - && typeof v[\\"@language\\"] === \\"string\\" - && typeof v[\\"@value\\"] === \\"string\\" ? new LanguageString(v[\\"@value\\"], v[\\"@language\\"]) : undefined - ; - if (typeof decoded === \\"undefined\\") continue; - _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.push(decoded); - + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) + && globalThis.Object.keys(v).length === 1) { + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( + !URL.canParse(v[\\"@id\\"]) && v[\\"@id\\"].startsWith(\\"at://\\") + ? new URL(\\"at://\\" + encodeURIComponent(v[\\"@id\\"].substring(5))) + : new URL(v[\\"@id\\"]) + ); + continue; + } + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + )) } - instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { try { @@ -16163,24 +22500,9 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return instance; } - protected _getCustomInspectProxy(): Record { - - const proxy: Record = {}; - if (this.id != null) { - proxy.id = { - [Symbol.for(\\"Deno.customInspect\\")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => \\"URL \\" + inspect(this.id!.href, options), - [Symbol.for(\\"nodejs.util.inspect.custom\\")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => \\"URL \\" + inspect(this.id!.href, options), - }; - } - - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -16196,11 +22518,11 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } : v); - if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { - proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; } - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -16216,8 +22538,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } : v); - if (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { - proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; } return proxy; @@ -16226,26 +22548,368 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any -(PropertyValue.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = +(ReplyAuthorization.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = function ( - this: PropertyValue, + this: ReplyAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return \\"PropertyValue \\" + inspect(proxy, options); + return \\"ReplyAuthorization \\" + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(PropertyValue.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = +(ReplyAuthorization.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = function ( - this: PropertyValue, + this: ReplyAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return \\"PropertyValue \\" + inspect(proxy, options); + return \\"ReplyAuthorization \\" + inspect(proxy, options); + }; + /** A request to reply to a post that requires approval from the post author. + * + * The \`object\` property references the post to be replied to, and + * the \`instrument\` property contains the reply itself (e.g., a {@link Note}). + * + * The post author responds with an {@link Accept} (with a + * {@link ReplyAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * + */ +export class ReplyRequest extends Activity { + + /** + * The type URI of {@link ReplyRequest}: \`https://gotosocial.org/ns#ReplyRequest\`. + */ + static override get typeId(): URL { + return new URL(\\"https://gotosocial.org/ns#ReplyRequest\\"); + } + + /** + * Constructs a new instance of ReplyRequest with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): ReplyRequest { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as ReplyRequest; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: \\"compact\\" | \\"expand\\", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== \\"compact\\" && options.context != null) { + throw new TypeError( + \\"The context option can only be used when the format option is set \\" + + \\"to 'compact'.\\" + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: \\"expand\\", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { \\"@list\\": unknown[] } | string + >; + + values[\\"@type\\"] = [\\"https://gotosocial.org/ns#ReplyRequest\\"]; + if (this.id != null) values[\\"@id\\"] = this.id.href; + if (options.format === \\"expand\\") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if (\\"proof\\" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element[\\"@context\\"] = docContext; + } + } else { + compacted.proof[\\"@context\\"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + \\"@fedify/vocab-tools\\", + \\"0.0.0\\", + ); + return await tracer.startActiveSpan( + \\"activitypub.parse_object\\", + async (span) => { + try { + const object = await this.__fromJsonLd__ReplyRequest__( + json, span, options); + if (object.id != null) { + span.setAttribute(\\"activitypub.object.id\\", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__ReplyRequest__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === \\"undefined\\") { + throw new TypeError(\\"Invalid JSON-LD: undefined.\\"); + } + else if (json === null) throw new TypeError(\\"Invalid JSON-LD: null.\\"); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { \\"@id\\"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); + } + if (options.baseUrl == null && values[\\"@id\\"] != null) { + options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; + } + + if (\\"@type\\" in values) { + span.setAttribute(\\"activitypub.object.type\\", values[\\"@type\\"]); + } + if (\\"@type\\" in values && + !values[\\"@type\\"].every(t => t.startsWith(\\"_:\\"))) { + + if (!values[\\"@type\\"].includes(\\"https://gotosocial.org/ns#ReplyRequest\\")) { + throw new TypeError(\\"Invalid type: \\" + values[\\"@type\\"]); + } + } + + delete values[\\"@type\\"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ReplyRequest)) { + throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); + } + + if (!(\\"_fromSubclass\\" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger([\\"fedify\\", \\"vocab\\"]).warn( + \\"Failed to cache JSON-LD: {json}\\", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(ReplyRequest.prototype as any)[Symbol.for(\\"Deno.customInspect\\")] = + function ( + this: ReplyRequest, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ReplyRequest \\" + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(ReplyRequest.prototype as any)[Symbol.for(\\"nodejs.util.inspect.custom\\")] = + function ( + this: ReplyRequest, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return \\"ReplyRequest \\" + inspect(proxy, options); }; /** Means of communicating or interacting with the DID subject or associated * entities via one or more service endpoints. Examples include discovery @@ -19842,7 +26506,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -19884,7 +26548,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -19961,7 +26625,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -20182,7 +26846,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20224,7 +26888,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20301,7 +26965,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -20517,7 +27181,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20559,7 +27223,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20636,7 +27300,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -20897,7 +27561,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -21361,7 +28025,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -25780,7 +32444,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Application\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -26139,7 +32803,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -27442,7 +34106,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27484,7 +34148,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27561,7 +34225,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -27789,7 +34453,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27831,7 +34495,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27908,7 +34572,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -28122,7 +34786,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} , options: { documentLoader?: DocumentLoader, @@ -28171,7 +34835,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} = {}, options: { @@ -28295,7 +34959,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} result[\\"type\\"] = \\"Article\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -28340,7 +35004,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -28598,7 +35262,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -28660,7 +35324,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -28810,7 +35474,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Document\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -28872,7 +35536,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -29171,7 +35835,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -29207,7 +35871,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -29269,7 +35933,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Audio\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -29295,7 +35959,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -29510,7 +36174,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29552,7 +36216,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29629,7 +36293,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -29850,7 +36514,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29892,7 +36556,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29969,7 +36633,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -30224,7 +36888,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -30435,7 +37099,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} = {}, options: { @@ -33544,7 +40208,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"Collection\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -33768,7 +40432,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -34046,7 +40710,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -34655,7 +41319,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -34730,7 +41394,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} = {}, options: { @@ -35536,7 +42200,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"CollectionPage\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -35607,7 +42271,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -35974,7 +42638,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36016,7 +42680,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36093,7 +42757,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -36308,7 +42972,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36350,7 +43014,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36427,7 +43091,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -36640,7 +43304,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36682,7 +43346,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36759,7 +43423,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -38076,7 +44740,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -38112,7 +44776,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} = {}, options: { @@ -38174,7 +44838,7 @@ proofs?: (DataIntegrityProof | URL)[];} result[\\"type\\"] = \\"Event\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -38200,7 +44864,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -38416,7 +45080,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38458,7 +45122,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38535,7 +45199,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -38752,7 +45416,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38794,7 +45458,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38871,7 +45535,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -39132,7 +45796,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -39596,7 +46260,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -44015,7 +50679,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Group\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -44374,7 +51038,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -47060,7 +53724,7 @@ get names(): ((string | LanguageString))[] { v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } ) : typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -47640,7 +54304,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -47676,7 +54340,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -47738,7 +54402,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Image\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = \\"https://www.w3.org/ns/activitystreams\\"; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -47764,7 +54428,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - \\"https://www.w3.org/ns/activitystreams\\"; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -47980,7 +54644,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48022,7 +54686,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48099,7 +54763,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -48318,7 +54982,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48360,7 +55024,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48437,7 +55101,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -48652,7 +55316,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48694,7 +55358,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48771,7 +55435,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -48986,7 +55650,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49028,7 +55692,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49105,7 +55769,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -49320,7 +55984,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49362,7 +56026,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49439,7 +56103,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -49652,7 +56316,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49694,7 +56358,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49771,7 +56435,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -50285,7 +56949,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -50327,7 +56991,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -50404,7 +57068,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -50620,7 +57284,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} , options: { documentLoader?: DocumentLoader, @@ -50669,7 +57333,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} = {}, options: { @@ -50793,7 +57457,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} result[\\"type\\"] = \\"Note\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -50838,7 +57502,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -51099,7 +57763,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} , options: { documentLoader?: DocumentLoader, @@ -51154,7 +57818,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} = {}, options: { @@ -51484,7 +58148,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"OrderedCollection\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -51525,7 +58189,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -51686,7 +58350,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -51810,7 +58474,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -51878,7 +58542,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} = {}, options: { @@ -52252,7 +58916,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result[\\"type\\"] = \\"OrderedCollectionPage\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; return result; } @@ -52311,7 +58975,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":\\"toot:votersCount\\",\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -52472,7 +59136,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === \\"object\\" && \\"@type\\" in v - && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( + && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } @@ -52672,7 +59336,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -53136,7 +59800,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -57555,7 +64219,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Organization\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -57914,7 +64578,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -59214,7 +65878,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -59250,7 +65914,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -59312,7 +65976,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Page\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -59338,7 +66002,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -59599,7 +66263,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -60063,7 +66727,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -64482,7 +71146,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Person\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -64841,7 +71505,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -66150,7 +72814,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -66264,7 +72928,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} = {}, options: { @@ -66590,7 +73254,7 @@ proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number result[\\"type\\"] = \\"Place\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -66721,7 +73385,7 @@ proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -67176,7 +73840,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;describes?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -67225,7 +73889,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;describes?: Object | URL | null;} = {}, options: { @@ -67536,7 +74200,7 @@ proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} result[\\"type\\"] = \\"Profile\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -67577,7 +74241,7 @@ proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -67857,7 +74521,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -67976,7 +74640,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -68708,7 +75372,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\",{\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"sensitive\\":\\"as:sensitive\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"quoteUrl\\":\\"as:quoteUrl\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -69155,7 +75819,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69197,7 +75861,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69274,7 +75938,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -69489,7 +76153,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69531,7 +76195,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69608,7 +76272,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -69841,7 +76505,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];subject?: Object | URL | null;object?: Object | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;subject?: Object | URL | null;object?: Object | URL | null; objects?: (Object | URL)[];relationship?: Object | URL | null; relationships?: (Object | URL)[];} , @@ -69972,7 +76636,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];subject?: Object | URL | null;object?: Object | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;subject?: Object | URL | null;object?: Object | URL | null; objects?: (Object | URL)[];relationship?: Object | URL | null; relationships?: (Object | URL)[];} @@ -71033,7 +77697,7 @@ relationships?: (Object | URL)[];} result[\\"type\\"] = \\"Relationship\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -71104,7 +77768,7 @@ relationships?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -71481,7 +78145,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -71523,7 +78187,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -71600,7 +78264,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -71861,7 +78525,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -72325,7 +78989,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -76744,7 +83408,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result[\\"type\\"] = \\"Service\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; return result; } @@ -77103,7 +83767,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"Emoji\\":\\"toot:Emoji\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -79046,7 +85710,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79088,7 +85752,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79165,7 +85829,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -79380,7 +86044,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79422,7 +86086,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79499,7 +86163,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -79716,7 +86380,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;deleted?: Temporal.Instant | null;} , options: { documentLoader?: DocumentLoader, @@ -79765,7 +86429,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;deleted?: Temporal.Instant | null;} = {}, options: { @@ -79871,7 +86535,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} result[\\"type\\"] = \\"Tombstone\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -79915,7 +86579,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -80171,7 +86835,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80213,7 +86877,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80290,7 +86954,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -80510,7 +87174,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80552,7 +87216,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80629,7 +87293,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"litepub\\":\\"http://litepub.social/ns#\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"EmojiReact\\":\\"litepub:EmojiReact\\",\\"Emoji\\":\\"toot:Emoji\\"}]; const compacted = await jsonld.compact( values, docContext, @@ -80847,7 +87511,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80889,7 +87553,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80966,7 +87630,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"sensitive\\":\\"as:sensitive\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"quoteUrl\\":\\"as:quoteUrl\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/v1\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://www.w3.org/ns/did/v1\\",\\"https://w3id.org/security/multikey/v1\\",\\"https://gotosocial.org/ns\\",{\\"alsoKnownAs\\":{\\"@id\\":\\"as:alsoKnownAs\\",\\"@type\\":\\"@id\\"},\\"manuallyApprovesFollowers\\":\\"as:manuallyApprovesFollowers\\",\\"sensitive\\":\\"as:sensitive\\",\\"movedTo\\":{\\"@id\\":\\"as:movedTo\\",\\"@type\\":\\"@id\\"},\\"quoteUrl\\":\\"as:quoteUrl\\",\\"toot\\":\\"http://joinmastodon.org/ns#\\",\\"featured\\":{\\"@id\\":\\"toot:featured\\",\\"@type\\":\\"@id\\"},\\"featuredTags\\":{\\"@id\\":\\"toot:featuredTags\\",\\"@type\\":\\"@id\\"},\\"discoverable\\":\\"toot:discoverable\\",\\"suspended\\":\\"toot:suspended\\",\\"memorial\\":\\"toot:memorial\\",\\"indexable\\":\\"toot:indexable\\",\\"votersCount\\":{\\"@id\\":\\"toot:votersCount\\",\\"@type\\":\\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\"},\\"Emoji\\":\\"toot:Emoji\\",\\"Hashtag\\":\\"as:Hashtag\\",\\"schema\\":\\"http://schema.org#\\",\\"PropertyValue\\":\\"schema:PropertyValue\\",\\"value\\":\\"schema:value\\",\\"ChatMessage\\":\\"http://litepub.social/ns#ChatMessage\\",\\"fedibird\\":\\"http://fedibird.com/ns#\\",\\"quoteUri\\":\\"fedibird:quoteUri\\",\\"misskey\\":\\"https://misskey-hub.net/ns#\\",\\"_misskey_quote\\":\\"misskey:_misskey_quote\\",\\"_misskey_followedMessage\\":\\"misskey:_misskey_followedMessage\\",\\"isCat\\":\\"misskey:isCat\\",\\"emojiReactions\\":{\\"@id\\":\\"fedibird:emojiReactions\\",\\"@type\\":\\"@id\\"}}]; const compacted = await jsonld.compact( values, docContext, @@ -81179,7 +87843,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -81215,7 +87879,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -81277,7 +87941,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result[\\"type\\"] = \\"Video\\"; if (this.id != null) result[\\"id\\"] = this.id.href; - result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + result[\\"@context\\"] = [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; return result; } @@ -81303,7 +87967,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, @@ -81517,7 +88181,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -81559,7 +88223,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -81636,7 +88300,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\"]; + [\\"https://w3id.org/identity/v1\\",\\"https://www.w3.org/ns/activitystreams\\",\\"https://w3id.org/security/data-integrity/v1\\",\\"https://gotosocial.org/ns\\"]; const compacted = await jsonld.compact( values, docContext, diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap index f42b26359..04936cff9 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap @@ -147,6 +147,17 @@ export class Object { #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + #_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; +#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; + + #_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; + #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + + #_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; + #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + + #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; + #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); /** * Constructs a new instance of Object with the given values. @@ -173,7 +184,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -1053,6 +1064,71 @@ proofs?: (DataIntegrityProof | URL)[];} ); } } + + if ("interactionPolicy" in values && values.interactionPolicy != null) { + if (values.interactionPolicy instanceof InteractionPolicy) { + // @ts-ignore: type is checked above. + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = [values.interactionPolicy]; + + } else { + throw new TypeError( + "The interactionPolicy must be of type " + + "InteractionPolicy" + ".", + ); + } + } + + if ("approvedBy" in values && values.approvedBy != null) { + if (values.approvedBy instanceof URL) { + // @ts-ignore: type is checked above. + this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = [values.approvedBy]; + + } else { + throw new TypeError( + "The approvedBy must be of type " + + "URL" + ".", + ); + } + } + + if ("likeAuthorization" in values && values.likeAuthorization != null) { + if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.add(0); + } else { + throw new TypeError( + "The likeAuthorization must be of type " + + "LikeAuthorization | URL" + ".", + ); + } + } + + if ("replyAuthorization" in values && values.replyAuthorization != null) { + if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.add(0); + } else { + throw new TypeError( + "The replyAuthorization must be of type " + + "ReplyAuthorization | URL" + ".", + ); + } + } + + if ("announceAuthorization" in values && values.announceAuthorization != null) { + if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0); + } else { + throw new TypeError( + "The announceAuthorization must be of type " + + "AnnounceAuthorization | URL" + ".", + ); + } + } } /** @@ -1081,7 +1157,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} = {}, options: { @@ -1975,248 +2051,76 @@ proofs?: (DataIntegrityProof | URL)[];} ); } } + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + if ("interactionPolicy" in values && values.interactionPolicy != null) { + if (values.interactionPolicy instanceof InteractionPolicy) { + // @ts-ignore: type is checked above. + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = [values.interactionPolicy]; - return clone; - } - - async #fetchAttachment( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/vocab-tools", - "0.0.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to fetch {url}: {error}", - { error, url: url.href } + } else { + throw new TypeError( + "The interactionPolicy must be of type " + + "InteractionPolicy" + ".", ); - return null; } - throw error; } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#attachment_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== "trust" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === "throw") { - throw new Error( - "The object's @id (" + obj.id.href + ") has a different origin " + - "than the document URL (" + baseUrl.href + "); 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".' - ); - } - getLogger(["fedify", "vocab"]).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".', - { ...fetchResult, objectId: obj.id.href }, + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + if ("approvedBy" in values && values.approvedBy != null) { + if (values.approvedBy instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = [values.approvedBy]; + + } else { + throw new TypeError( + "The approvedBy must be of type " + + "URL" + ".", ); - return null; } - span.setAttribute("activitypub.object.id", (obj.id ?? url).href); - span.setAttribute( - "activitypub.object.type", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to parse {url}: {error}", - { error: e, url: url.href } + } + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization;clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization); + if ("likeAuthorization" in values && values.likeAuthorization != null) { + if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set([0]); + } else { + throw new TypeError( + "The likeAuthorization must be of type " + + "LikeAuthorization | URL" + ".", ); - return null; } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); } - }); - } - - async #attachment_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await PropertyValue.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Object","https://www.w3.org/ns/activitystreams#Link","http://schema.org#PropertyValue"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getAttachments}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get attachmentIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies a resource attached or related to an object that potentially - * requires special handling. The intent is to provide a model that is at - * least semantically similar to attachments in email. - * - */ - - async* getAttachments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchAttachment(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "attachment" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "attachment"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#attachment_fromJsonLd(obj, options); - } + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization;clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization); + if ("replyAuthorization" in values && values.replyAuthorization != null) { + if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set([0]); + } else { + throw new TypeError( + "The replyAuthorization must be of type " + + "ReplyAuthorization | URL" + ".", + ); } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization;clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization); + if ("announceAuthorization" in values && values.announceAuthorization != null) { + if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set([0]); + } else { + throw new TypeError( + "The announceAuthorization must be of type " + + "AnnounceAuthorization | URL" + ".", ); - continue; } - yield v; } - } - async #fetchAttribution( + return clone; + } + + async #fetchAttachment( url: URL, options: { documentLoader?: DocumentLoader, @@ -2225,7 +2129,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: "ignore" | "throw" | "trust"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2258,7 +2162,7 @@ proofs?: (DataIntegrityProof | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#attribution_fromJsonLd( + const obj = await this.#attachment_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -2307,7 +2211,7 @@ proofs?: (DataIntegrityProof | URL)[];} }); } - async #attribution_fromJsonLd( + async #attachment_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -2315,7 +2219,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL } - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2325,25 +2229,7 @@ proofs?: (DataIntegrityProof | URL)[];} const baseUrl = options.baseUrl; try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( + return await Object.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2352,7 +2238,7 @@ proofs?: (DataIntegrityProof | URL)[];} } try { - return await Person.fromJsonLd( + return await Link.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2361,7 +2247,7 @@ proofs?: (DataIntegrityProof | URL)[];} } try { - return await Service.fromJsonLd( + return await PropertyValue.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2370,129 +2256,34 @@ proofs?: (DataIntegrityProof | URL)[];} } throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Service"].join(", ")); + ["https://www.w3.org/ns/activitystreams#Object","https://www.w3.org/ns/activitystreams#Link","http://schema.org#PropertyValue"].join(", ")); } /** * Similar to - * {@link Object.getAttribution}, - * but returns its \`@id\` URL instead of the object itself. - */ - get attributionId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; - const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies one or more entities to which this object is attributed. - * The attributed entities might not be Actors. For instance, - * an object might be attributed to the completion of another activity. - * - */ - - async getAttribution( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; - let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchAttribution(v, options); - if (fetched == null) return null; - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "attributedTo" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "attributedTo"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#attribution_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; - } - - /** - * Similar to - * {@link Object.getAttributions}, + * {@link Object.getAttachments}, * but returns their \`@id\`s instead of the objects themselves. */ - get attributionIds(): URL[] { + get attachmentIds(): URL[] { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.map((v) => + return this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.map((v) => v instanceof URL ? v : v.id! ).filter(id => id !== null); } -/** Identifies one or more entities to which this object is attributed. - * The attributed entities might not be Actors. For instance, - * an object might be attributed to the completion of another activity. +/** Identifies a resource attached or related to an object that potentially + * requires special handling. The intent is to provide a model that is at + * least semantically similar to attachments in email. * */ - async* getAttributions( + async* getAttachments( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2500,27 +2291,27 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: "ignore" | "throw" | "trust"; } = {} - ): AsyncIterable { + ): AsyncIterable { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + const vs = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (options.crossOrigin !== "trust" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAttribution(v, options); + await this.#fetchAttachment(v, options); if (fetched == null) continue; vs[i] = fetched; - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); this._cachedJsonLd = undefined; yield fetched; continue; @@ -2530,19 +2321,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && - "attributedTo" in this._cachedJsonLd + "attachment" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - "attributedTo"]; + "attachment"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#attribution_fromJsonLd(obj, options); + v = await this.#attachment_fromJsonLd(obj, options); } } if (options.crossOrigin !== "trust" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(0)) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -2566,7 +2357,7 @@ proofs?: (DataIntegrityProof | URL)[];} } } - async #fetchAudience( + async #fetchAttribution( url: URL, options: { documentLoader?: DocumentLoader, @@ -2575,7 +2366,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: "ignore" | "throw" | "trust"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2608,7 +2399,7 @@ proofs?: (DataIntegrityProof | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#audience_fromJsonLd( + const obj = await this.#attribution_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -2657,7 +2448,7 @@ proofs?: (DataIntegrityProof | URL)[];} }); } - async #audience_fromJsonLd( + async #attribution_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -2665,7 +2456,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL } - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2675,7 +2466,43 @@ proofs?: (DataIntegrityProof | URL)[];} const baseUrl = options.baseUrl; try { - return await Object.fromJsonLd( + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( jsonLd, { documentLoader, contextLoader, tracerProvider, baseUrl }, ); @@ -2684,34 +2511,35 @@ proofs?: (DataIntegrityProof | URL)[];} } throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + ["https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Service"].join(", ")); } /** * Similar to - * {@link Object.getAudience}, + * {@link Object.getAttribution}, * but returns its \`@id\` URL instead of the object itself. */ - get audienceId(): URL | null { + get attributionId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; - const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; + const v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (v instanceof URL) return v; return v.id; } -/** Identifies one or more entities that represent the total population of - * entities for which the object can considered to be relevant. +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. * */ - async getAudience( + async getAttribution( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2719,26 +2547,26 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: "ignore" | "throw" | "trust"; } = {} - ): Promise { + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; - let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < 1) return null; + let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (options.crossOrigin !== "trust" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAudience(v, options); + await this.#fetchAttribution(v, options); if (fetched == null) return null; - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(0); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(0); this._cachedJsonLd = undefined; return fetched; } @@ -2747,19 +2575,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && - "audience" in this._cachedJsonLd + "attributedTo" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - "audience"]; + "attributedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#audience_fromJsonLd(doc, options); + v = await this.#attribution_fromJsonLd(doc, options); } } if (options.crossOrigin !== "trust" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -2784,27 +2612,28 @@ proofs?: (DataIntegrityProof | URL)[];} /** * Similar to - * {@link Object.getAudiences}, + * {@link Object.getAttributions}, * but returns their \`@id\`s instead of the objects themselves. */ - get audienceIds(): URL[] { + get attributionIds(): URL[] { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.map((v) => + return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.map((v) => v instanceof URL ? v : v.id! ).filter(id => id !== null); } -/** Identifies one or more entities that represent the total population of - * entities for which the object can considered to be relevant. +/** Identifies one or more entities to which this object is attributed. + * The attributed entities might not be Actors. For instance, + * an object might be attributed to the completion of another activity. * */ - async* getAudiences( + async* getAttributions( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -2812,27 +2641,27 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, crossOrigin?: "ignore" | "throw" | "trust"; } = {} - ): AsyncIterable { + ): AsyncIterable { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (options.crossOrigin !== "trust" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchAudience(v, options); + await this.#fetchAttribution(v, options); if (fetched == null) continue; vs[i] = fetched; - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); this._cachedJsonLd = undefined; yield fetched; continue; @@ -2842,19 +2671,19 @@ proofs?: (DataIntegrityProof | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && - "audience" in this._cachedJsonLd + "attributedTo" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - "audience"]; + "attributedTo"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#audience_fromJsonLd(obj, options); + v = await this.#attribution_fromJsonLd(obj, options); } } if (options.crossOrigin !== "trust" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -2878,36 +2707,7 @@ proofs?: (DataIntegrityProof | URL)[];} } } -/** The content or textual representation of the Object encoded as a JSON - * string. By default, the value of \`content\` is HTML. The \`mediaType\` - * property can be used in the object to indicate a different content type. - * - * The content MAY be expressed using multiple language-tagged values. - * - */ - get content(): (string | LanguageString | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) return null; - return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; - } - -/** The content or textual representation of the Object encoded as a JSON - * string. By default, the value of \`content\` is HTML. The \`mediaType\` - * property can be used in the object to indicate a different content type. - * - * The content MAY be expressed using multiple language-tagged values. - * - */ -get contents(): ((string | LanguageString))[] { - return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; - } - - async #fetchContext( + async #fetchAudience( url: URL, options: { documentLoader?: DocumentLoader, @@ -2916,7 +2716,7 @@ get contents(): ((string | LanguageString))[] { tracerProvider?: TracerProvider, crossOrigin?: "ignore" | "throw" | "trust"; } = {}, - ): Promise { + ): Promise { const documentLoader = options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); const contextLoader = @@ -2949,7 +2749,348 @@ get contents(): ((string | LanguageString))[] { const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#context_fromJsonLd( + const obj = await this.#audience_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #audience_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link Object.getAudience}, + * but returns its \`@id\` URL instead of the object itself. + */ + get audienceId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; + const v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async getAudience( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < 1) return null; + let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + if (fetched == null) return null; + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "audience" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "audience"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#audience_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Object.getAudiences}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get audienceIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more entities that represent the total population of + * entities for which the object can considered to be relevant. + * + */ + + async* getAudiences( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAudience(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "audience" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "audience"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#audience_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ + get content(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < 1) return null; + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; + } + +/** The content or textual representation of the Object encoded as a JSON + * string. By default, the value of \`content\` is HTML. The \`mediaType\` + * property can be used in the object to indicate a different content type. + * + * The content MAY be expressed using multiple language-tagged values. + * + */ +get contents(): ((string | LanguageString))[] { + return this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; + } + + async #fetchContext( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#context_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -7810,174 +7951,861 @@ get urls(): ((URL | Link))[] { } } - /** - * Converts this object to a JSON-LD structure. - * @param options The options to use. - * - \`format\`: The format of the output: \`compact\` or - \`expand\`. - * - \`contextLoader\`: The loader for remote JSON-LD contexts. - * - \`context\`: The JSON-LD context to use. Not applicable - when \`format\` is set to \`'expand'\`. - * @returns The JSON-LD representation of this object. - */ - async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], - } = {}): Promise { - if (options.format == null && this._cachedJsonLd != null) { - return this._cachedJsonLd; - } - if (options.format !== "compact" && options.context != null) { - throw new TypeError( - "The context option can only be used when the format option is set " + - "to 'compact'." - ); - } - options = { - ...options, - contextLoader: options.contextLoader ?? getDocumentLoader(), - }; - - if (options.format == null && this.isCompactable()) { - const result: Record = {}; - // deno-lint-ignore no-unused-vars - let compactItems: unknown[]; - - compactItems = []; - for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { - const item = ( - v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Link ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); +/** The interaction policy for this object, specifying who can like, reply to, + * or announce it. Contains sub-policies (\`canLike\`, \`canReply\`, + * \`canAnnounce\`) each defining \`automaticApproval\` and \`manualApproval\` + * lists. + * + * When absent, implementations should assume anyone can interact with + * the object. Setting this property signals that the server understands + * and will enforce interaction controls. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * + */ + get interactionPolicy(): (InteractionPolicy | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length < 1) return null; + return this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[0]; } - if (compactItems.length > 0) { - result["attachment"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - +/** A URI referencing an authorization object that proves this interaction + * was approved by the target post's author. + * + */ + get approvedBy(): (URL | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length < 1) return null; + return this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[0]; } - compactItems = []; - for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { - const item = ( - v instanceof URL ? v.href : v instanceof Application ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Group ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Organization ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : v instanceof Person ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); + async #fetchLikeAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#likeAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #likeAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL } - if (compactItems.length > 0) { + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await LikeAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - result["attributedTo"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + throw new TypeError("Expected an object of any type of: " + + ["https://gotosocial.org/ns#LikeApproval"].join(", ")); + } + + + /** + * Similar to + * {@link Object.getLikeAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get likeAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < 1) return null; + const v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + if (v instanceof URL) return v; + return v.id; } - compactItems = []; - for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); - } - if (compactItems.length > 0) { +/** A {@link LikeAuthorization} object that proves this like interaction + * was approved by the target post's author. + * + */ + + async getLikeAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < 1) return null; + let v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchLikeAuthorization(v, options); + if (fetched == null) return null; + this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0] = fetched; + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } - result["audience"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "likeAuthorization" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "likeAuthorization"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#likeAuthorization_fromJsonLd(doc, options); + } + } + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } - compactItems = []; - for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { - const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.locale.baseName, - } - ); - compactItems.push(item); + async #fetchReplyAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#replyAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #replyAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL } - if (compactItems.length > 0) { + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await ReplyAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - result["content"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + throw new TypeError("Expected an object of any type of: " + + ["https://gotosocial.org/ns#ReplyAuthorization"].join(", ")); + } + + + /** + * Similar to + * {@link Object.getReplyAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get replyAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < 1) return null; + const v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + if (v instanceof URL) return v; + return v.id; } - compactItems = []; - for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { - const item = ( - v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); - compactItems.push(item); - } - if (compactItems.length > 0) { +/** A {@link ReplyAuthorization} object that proves this reply was approved + * by the target post's author. + * + */ + + async getReplyAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < 1) return null; + let v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchReplyAuthorization(v, options); + if (fetched == null) return null; + this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0] = fetched; + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } - result["context"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "replyAuthorization" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "replyAuthorization"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#replyAuthorization_fromJsonLd(doc, options); + } + } - } - - compactItems = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { - const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.locale.baseName, - } + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + async #fetchAnnounceAuthorization( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#announceAuthorization_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #announceAuthorization_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await AnnounceAuthorization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://gotosocial.org/ns#AnnounceAuthorization"].join(", ")); + } + + + /** + * Similar to + * {@link Object.getAnnounceAuthorization}, + * but returns its \`@id\` URL instead of the object itself. + */ + get announceAuthorizationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < 1) return null; + const v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** An {@link AnnounceAuthorization} object that proves this announce + * (boost) was approved by the target post's author. + * + */ + + async getAnnounceAuthorization( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < 1) return null; + let v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchAnnounceAuthorization(v, options); + if (fetched == null) return null; + this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0] = fetched; + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "announceAuthorization" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "announceAuthorization"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#announceAuthorization_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + const result: Record = {}; + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + const item = ( + v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Link ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["attachment"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + const item = ( + v instanceof URL ? v.href : v instanceof Application ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Group ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Organization ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : v instanceof Person ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["attributedTo"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["audience"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + const item = ( + typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["content"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + const item = ( + v instanceof URL ? v.href : v instanceof Object ? await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["context"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const item = ( + typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.locale.baseName, + } ); compactItems.push(item); } @@ -8501,9 +9329,105 @@ get urls(): ((URL | Link))[] { } + compactItems = []; + for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + const item = ( + await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["interactionPolicy"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + const item = ( + v.href + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["approvedBy"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["likeAuthorization"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["replyAuthorization"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["announceAuthorization"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + result["type"] = "Object"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -9014,6 +9938,81 @@ get urls(): ((URL | Link))[] { } + array = []; + for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#interactionPolicy"] = propValue; + + } + + array = []; + for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + const element = ( + { "@id": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#approvedBy"] = propValue; + + } + + array = []; + for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#likeAuthorization"] = propValue; + + } + + array = []; + for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#replyAuthorization"] = propValue; + + } + + array = []; + for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#announceAuthorization"] = propValue; + + } + values["@type"] = ["https://www.w3.org/ns/activitystreams#Object"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -9023,7 +10022,7 @@ get urls(): ((URL | Link))[] { ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -9069,6 +10068,11 @@ get urls(): ((URL | Link))[] { this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0 ) return false; + if ( + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy != null && + this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length > 0 + ) return false; + return true; } @@ -9171,6 +10175,18 @@ get urls(): ((URL | Link))[] { return await ChatMessage.fromJsonLd(json, options); } + if (values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) { + return await AnnounceAuthorization.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#LikeApproval")) { + return await LikeAuthorization.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#ReplyAuthorization")) { + return await ReplyAuthorization.fromJsonLd(json, options); + } + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) { return await Activity.fromJsonLd(json, options); } @@ -9179,6 +10195,18 @@ get urls(): ((URL | Link))[] { return await EmojiReact.fromJsonLd(json, options); } + if (values["@type"].includes("https://gotosocial.org/ns#AnnounceRequest")) { + return await AnnounceRequest.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#LikeRequest")) { + return await LikeRequest.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#ReplyRequest")) { + return await ReplyRequest.fromJsonLd(json, options); + } + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) { return await Accept.fromJsonLd(json, options); } @@ -9415,7 +10443,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -9569,7 +10597,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -9655,7 +10683,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -9758,7 +10786,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -9801,7 +10829,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -9849,7 +10877,7 @@ get urls(): ((URL | Link))[] { v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } ) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -10069,7 +11097,7 @@ get urls(): ((URL | Link))[] { const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -10360,6 +11388,144 @@ get urls(): ((URL | Link))[] { )) } instance.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + const _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; + + let _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array = values["https://gotosocial.org/ns#interactionPolicy"]; + + for ( + const v of _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array == null + ? [] + : _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array.length === 1 && "@list" in _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array[0] + ? _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array[0]["@list"] + : _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy__array + ) { + if (v == null) continue; + _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.push(await InteractionPolicy.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + const _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; + + let _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array = values["https://gotosocial.org/ns#approvedBy"]; + + for ( + const v of _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array == null + ? [] + : _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array.length === 1 && "@list" in _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array[0] + ? _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array[0]["@list"] + : _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy__array + ) { + if (v == null) continue; + _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.push(v["@id"].startsWith("at://") + ? new URL("at://" + + encodeURIComponent( + v["@id"].includes("/", 5) + ? v["@id"].slice(5, v["@id"].indexOf("/", 5)) + : v["@id"].slice(5) + ) + + ( + v["@id"].includes("/", 5) + ? v["@id"].slice(v["@id"].indexOf("/", 5)) + : "" + ) + ) + : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + ? new URL(v["@id"]) + : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"])))) + } + instance.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + + const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; + const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + + let _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array = values["https://gotosocial.org/ns#likeAuthorization"]; + + for ( + const v of _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array == null + ? [] + : _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array.length === 1 && "@list" in _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array[0] + ? _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array[0]["@list"] + : _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push(await LikeAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; + + const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; + const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + + let _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array = values["https://gotosocial.org/ns#replyAuthorization"]; + + for ( + const v of _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array == null + ? [] + : _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array.length === 1 && "@list" in _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array[0] + ? _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array[0]["@list"] + : _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push(await ReplyAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; + + const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; + const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + + let _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array = values["https://gotosocial.org/ns#announceAuthorization"]; + + for ( + const v of _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array == null + ? [] + : _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array.length === 1 && "@list" in _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array[0] + ? _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array[0]["@list"] + : _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(await AnnounceAuthorization.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization; if (!("_fromSubclass" in options) || !options._fromSubclass) { try { @@ -10873,223 +12039,5428 @@ get urls(): ((URL | Link))[] { } : v); - if (_5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 1 - || !("tag" in proxy) - && _5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 0) { - proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + if (_5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 1 + || !("tag" in proxy) + && _5chuqj6s95p5gg2sk1HntGfarRf_tag.length > 0) { + proxy.tags = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + } + + const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length == 1) { + proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + } + + const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) { + proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + } + + if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 + || !("url" in proxy) + && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) { + proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + } + + const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length == 1) { + proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + } + + if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 1 + || !("to" in proxy) + && _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 0) { + proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + } + + const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length == 1) { + proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; + } + + if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 1 + || !("bto" in proxy) + && _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 0) { + proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + } + + const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length == 1) { + proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; + } + + if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 1 + || !("cc" in proxy) + && _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 0) { + proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + } + + const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length == 1) { + proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + } + + if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 1 + || !("bcc" in proxy) + && _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 0) { + proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + } + + const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length == 1) { + proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; + } + + const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length == 1) { + proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; + } + + const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length == 1) { + proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + } + + const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length == 1) { + proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + } + + const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length == 1) { + proxy.proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; + } + + if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 1 + || !("proof" in proxy) + && _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) { + proxy.proofs = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + } + + const _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length == 1) { + proxy.interactionPolicy = _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[0]; + } + + const _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length == 1) { + proxy.approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[0]; + } + + const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length == 1) { + proxy.likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; + } + + const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length == 1) { + proxy.replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; + } + + const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length == 1) { + proxy.announceAuthorization = _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Object.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: Object, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Object " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Object.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: Object, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Object " + inspect(proxy, options); + }; + /** Represents a custom emoji. + */ +export class Emoji extends Object { + + /** + * The type URI of {@link Emoji}: \`http://joinmastodon.org/ns#Emoji\`. + */ + static override get typeId(): URL { + return new URL("http://joinmastodon.org/ns#Emoji"); + } + + /** + * Constructs a new instance of Emoji with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): Emoji { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Emoji; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + result["type"] = "Emoji"; + if (this.id != null) result["id"] = this.id.href; + result["@context"] = ["https://www.w3.org/ns/activitystreams",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; + return result; + } + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: "expand", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { "@list": unknown[] } | string + >; + + values["@type"] = ["http://joinmastodon.org/ns#Emoji"]; + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + ["https://www.w3.org/ns/activitystreams",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if ("proof" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element["@context"] = docContext; + } + } else { + compacted.proof["@context"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__Emoji__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__Emoji__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("http://joinmastodon.org/ns#Emoji")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + delete values["@type"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof Emoji)) { + throw new TypeError("Unexpected type: " + instance.constructor.name); + } + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Emoji.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: Emoji, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Emoji " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Emoji.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: Emoji, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Emoji " + inspect(proxy, options); + }; + /** \`ChatMessage\`s are the messages sent in 1-on-1 chats. They are similar to + * {@link Note}s, but the addressing is done by having a single AP actor in + * the \`to\` field. Addressing multiple actors is not allowed. These messages + * are always private, there is no public version of them. They are created with + * a {@link Create} activity. + * + */ +export class ChatMessage extends Object { + + /** + * The type URI of {@link ChatMessage}: \`http://litepub.social/ns#ChatMessage\`. + */ + static override get typeId(): URL { + return new URL("http://litepub.social/ns#ChatMessage"); + } + #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; + + /** + * Constructs a new instance of ChatMessage with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if ("quoteUrl" in values && values.quoteUrl != null) { + if (values.quoteUrl instanceof URL) { + // @ts-ignore: type is checked above. + this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; + + } else { + throw new TypeError( + "The quoteUrl must be of type " + + "URL" + ".", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): ChatMessage { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + if ("quoteUrl" in values && values.quoteUrl != null) { + if (values.quoteUrl instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; + + } else { + throw new TypeError( + "The quoteUrl must be of type " + + "URL" + ".", + ); + } + } + + return clone; + } + +/** The URI of the ActivityStreams object that this object quotes. + * + * This property sets three JSON-LD properties at once under the hood: + * + * 1. https://www.w3.org/ns/activitystreams#quoteUrl + * 2. https://misskey-hub.net/ns#_misskey_quote + * 3. http://fedibird.com/ns#quoteUri + * + * When a JSON-LD object is parsed, this property is filled with one of + * the values of those three properties in order. + * + */ + get quoteUrl(): (URL | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < 1) return null; + return this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + const item = ( + v.href + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["quoteUrl"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result["_misskey_quote"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result["quoteUri"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result["type"] = "ChatMessage"; + if (this.id != null) result["id"] = this.id.href; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","Emoji":"toot:Emoji","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + return result; + } + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: "expand", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { "@list": unknown[] } | string + >; + + array = []; + for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + const element = ( + { "@value": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#quoteUrl"] = propValue; + + values["https://misskey-hub.net/ns#_misskey_quote"] = propValue; + + values["http://fedibird.com/ns#quoteUri"] = propValue; + + } + + values["@type"] = ["http://litepub.social/ns#ChatMessage"]; + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","Emoji":"toot:Emoji","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if ("proof" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element["@context"] = docContext; + } + } else { + compacted.proof["@context"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__ChatMessage__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__ChatMessage__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("http://litepub.social/ns#ChatMessage")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + delete values["@type"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ChatMessage)) { + throw new TypeError("Unexpected type: " + instance.constructor.name); + } + const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; + + let _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["https://www.w3.org/ns/activitystreams#quoteUrl"]; + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["https://misskey-hub.net/ns#_misskey_quote"]; + } + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"]; + } + + 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 + ) { + if (v == null) continue; + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v["@value"])) + } + instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length == 1) { + proxy.quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(ChatMessage.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: ChatMessage, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "ChatMessage " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(ChatMessage.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: ChatMessage, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "ChatMessage " + inspect(proxy, options); + }; + /** An Activity is a subtype of {@link Object} that describes some form of action + * that may happen, is currently happening, or has already happened. + * The {@link Activity} type itself serves as an abstract base type for all types + * of activities. It is important to note that the {@link Activity} type itself + * does not carry any specific semantics about the kind of action being taken. + * + */ +export class Activity extends Object { + + /** + * The type URI of {@link Activity}: \`https://www.w3.org/ns/activitystreams#Activity\`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Activity"); + } + + #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + + #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + + #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + + #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + + #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + + #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + + /** + * Constructs a new instance of Activity with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if ("actor" in values && values.actor != null) { + if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); + } else { + throw new TypeError( + "The actor must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("actors" in values && values.actors != null) { + + if ("actor" in values && + values.actor != null) { + throw new TypeError( + "Cannot initialize both actor and " + + "actors at the same time.", + ); + } + + if (Array.isArray(values.actors) && + values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; + + for (let i = 0; i < values.actors.length; i++) { + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + } + + } else { + throw new TypeError( + "The actors must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("object" in values && values.object != null) { + if (values.object instanceof Object || values.object instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); + } else { + throw new TypeError( + "The object must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("objects" in values && values.objects != null) { + + if ("object" in values && + values.object != null) { + throw new TypeError( + "Cannot initialize both object and " + + "objects at the same time.", + ); + } + + if (Array.isArray(values.objects) && + values.objects.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; + + for (let i = 0; i < values.objects.length; i++) { + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + } + + } else { + throw new TypeError( + "The objects must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("target" in values && values.target != null) { + if (values.target instanceof Object || values.target instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); + } else { + throw new TypeError( + "The target must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("targets" in values && values.targets != null) { + + if ("target" in values && + values.target != null) { + throw new TypeError( + "Cannot initialize both target and " + + "targets at the same time.", + ); + } + + if (Array.isArray(values.targets) && + values.targets.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; + + for (let i = 0; i < values.targets.length; i++) { + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + } + + } else { + throw new TypeError( + "The targets must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("result" in values && values.result != null) { + if (values.result instanceof Object || values.result instanceof URL) { + // @ts-ignore: type is checked above. + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); + } else { + throw new TypeError( + "The result must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("results" in values && values.results != null) { + + if ("result" in values && + values.result != null) { + throw new TypeError( + "Cannot initialize both result and " + + "results at the same time.", + ); + } + + if (Array.isArray(values.results) && + values.results.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; + + for (let i = 0; i < values.results.length; i++) { + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + } + + } else { + throw new TypeError( + "The results must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("origin" in values && values.origin != null) { + if (values.origin instanceof Object || values.origin instanceof URL) { + // @ts-ignore: type is checked above. + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); + } else { + throw new TypeError( + "The origin must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("origins" in values && values.origins != null) { + + if ("origin" in values && + values.origin != null) { + throw new TypeError( + "Cannot initialize both origin and " + + "origins at the same time.", + ); + } + + if (Array.isArray(values.origins) && + values.origins.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; + + for (let i = 0; i < values.origins.length; i++) { + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + } + + } else { + throw new TypeError( + "The origins must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("instrument" in values && values.instrument != null) { + if (values.instrument instanceof Object || values.instrument instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + } else { + throw new TypeError( + "The instrument must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("instruments" in values && values.instruments != null) { + + if ("instrument" in values && + values.instrument != null) { + throw new TypeError( + "Cannot initialize both instrument and " + + "instruments at the same time.", + ); + } + + if (Array.isArray(values.instruments) && + values.instruments.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + + for (let i = 0; i < values.instruments.length; i++) { + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + } + + } else { + throw new TypeError( + "The instruments must be an array of type " + + "Object | URL" + ".", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): Activity { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor;clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); + if ("actor" in values && values.actor != null) { + if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); + } else { + throw new TypeError( + "The actor must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("actors" in values && values.actors != null) { + + if ("actor" in values && + values.actor != null) { + throw new TypeError( + "Cannot update both actor and " + + "actors at the same time.", + ); + } + + if (Array.isArray(values.actors) && + values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; + + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); + for (let i = 0; i < values.actors.length; i++) { + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + } + + } else { + throw new TypeError( + "The actors must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object;clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + if ("object" in values && values.object != null) { + if (values.object instanceof Object || values.object instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + } else { + throw new TypeError( + "The object must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("objects" in values && values.objects != null) { + + if ("object" in values && + values.object != null) { + throw new TypeError( + "Cannot update both object and " + + "objects at the same time.", + ); + } + + if (Array.isArray(values.objects) && + values.objects.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; + + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + for (let i = 0; i < values.objects.length; i++) { + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + } + + } else { + throw new TypeError( + "The objects must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target;clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); + if ("target" in values && values.target != null) { + if (values.target instanceof Object || values.target instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); + } else { + throw new TypeError( + "The target must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("targets" in values && values.targets != null) { + + if ("target" in values && + values.target != null) { + throw new TypeError( + "Cannot update both target and " + + "targets at the same time.", + ); + } + + if (Array.isArray(values.targets) && + values.targets.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; + + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); + for (let i = 0; i < values.targets.length; i++) { + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + } + + } else { + throw new TypeError( + "The targets must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result;clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); + if ("result" in values && values.result != null) { + if (values.result instanceof Object || values.result instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); + } else { + throw new TypeError( + "The result must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("results" in values && values.results != null) { + + if ("result" in values && + values.result != null) { + throw new TypeError( + "Cannot update both result and " + + "results at the same time.", + ); + } + + if (Array.isArray(values.results) && + values.results.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; + + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); + for (let i = 0; i < values.results.length; i++) { + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + } + + } else { + throw new TypeError( + "The results must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin;clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); + if ("origin" in values && values.origin != null) { + if (values.origin instanceof Object || values.origin instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); + } else { + throw new TypeError( + "The origin must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("origins" in values && values.origins != null) { + + if ("origin" in values && + values.origin != null) { + throw new TypeError( + "Cannot update both origin and " + + "origins at the same time.", + ); + } + + if (Array.isArray(values.origins) && + values.origins.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; + + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); + for (let i = 0; i < values.origins.length; i++) { + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + } + + } else { + throw new TypeError( + "The origins must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument;clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); + if ("instrument" in values && values.instrument != null) { + if (values.instrument instanceof Object || values.instrument instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); + } else { + throw new TypeError( + "The instrument must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("instruments" in values && values.instruments != null) { + + if ("instrument" in values && + values.instrument != null) { + throw new TypeError( + "Cannot update both instrument and " + + "instruments at the same time.", + ); + } + + if (Array.isArray(values.instruments) && + values.instruments.every(v => v instanceof Object || v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); + for (let i = 0; i < values.instruments.length; i++) { + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + } + + } else { + throw new TypeError( + "The instruments must be an array of type " + + "Object | URL" + ".", + ); + } + } + + return clone; + } + + async #fetchActor( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#actor_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #actor_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Service"].join(", ")); + } + + + /** + * Similar to + * {@link Activity.getActor}, + * but returns its \`@id\` URL instead of the object itself. + */ + get actorId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; + const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async getActor( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; + let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + if (fetched == null) return null; + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "actor" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "actor"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#actor_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getActors}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get actorIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes one or more entities that either performed or are expected to + * perform the activity. Any single activity can have multiple actors. + * The actor MAY be specified using an indirect {@link Link}. + * + */ + + async* getActors( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchActor(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "actor" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "actor"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#actor_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#object_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #object_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link Activity.getObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get objectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; + const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity "John added a movie to his + * wishlist", the object of the activity is the movie added. + * + */ + + async getObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; + let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + if (fetched == null) return null; + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "object" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "object"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#object_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getObjects}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get objectIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** When used within an {@link Activity}, describes the direct object of + * the activity. For instance, in the activity "John added a movie to his + * wishlist", the object of the activity is the movie added. + * + */ + + async* getObjects( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchObject(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "object" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "object"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#object_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#target_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #target_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link Activity.getTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get targetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; + const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the indirect object, or target, of the activity. The precise + * meaning of the target is largely dependent on the type of action being + * described but will often be the object of the English preposition "to". + * For instance, in the activity "John added a movie to his wishlist", + * the target of the activity is John's wishlist. An activity can have more + * than one target. + * + */ + + async getTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; + let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchTarget(v, options); + if (fetched == null) return null; + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "target" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "target"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#target_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getTargets}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get targetIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the indirect object, or target, of the activity. The precise + * meaning of the target is largely dependent on the type of action being + * described but will often be the object of the English preposition "to". + * For instance, in the activity "John added a movie to his wishlist", + * the target of the activity is John's wishlist. An activity can have more + * than one target. + * + */ + + async* getTargets( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchTarget(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "target" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "target"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#target_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchResult( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#result_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #result_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link Activity.getResult}, + * but returns its \`@id\` URL instead of the object itself. + */ + get resultId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; + const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes the result of the activity. For instance, if a particular action + * results in the creation of a new resource, the result property can be used + * to describe that new resource. + * + */ + + async getResult( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; + let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchResult(v, options); + if (fetched == null) return null; + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "result" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "result"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#result_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getResults}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get resultIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes the result of the activity. For instance, if a particular action + * results in the creation of a new resource, the result property can be used + * to describe that new resource. + * + */ + + async* getResults( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchResult(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "result" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "result"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#result_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchOrigin( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#origin_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #origin_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link Activity.getOrigin}, + * but returns its \`@id\` URL instead of the object itself. + */ + get originId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; + const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Describes an indirect object of the activity from which the activity is + * directed. The precise meaning of the origin is the object of the English + * preposition "from". For instance, in the activity "John moved an item to + * List B from List A", the origin of the activity is "List A". + * + */ + + async getOrigin( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; + let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchOrigin(v, options); + if (fetched == null) return null; + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "origin" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "origin"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#origin_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getOrigins}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get originIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Describes an indirect object of the activity from which the activity is + * directed. The precise meaning of the origin is the object of the English + * preposition "from". For instance, in the activity "John moved an item to + * List B from List A", the origin of the activity is "List A". + * + */ + + async* getOrigins( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchOrigin(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "origin" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "origin"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#origin_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + async #fetchInstrument( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#instrument_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #instrument_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link Activity.getInstrument}, + * but returns its \`@id\` URL instead of the object itself. + */ + get instrumentId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; + const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** Identifies one or more objects used (or to be used) in the completion of + * an {@link Activity}. + * + */ + + async getInstrument( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; + let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInstrument(v, options); + if (fetched == null) return null; + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "instrument" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "instrument"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#instrument_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + /** + * Similar to + * {@link Activity.getInstruments}, + * but returns their \`@id\`s instead of the objects themselves. + */ + get instrumentIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.map((v) => + v instanceof URL ? v : v.id! + ).filter(id => id !== null); + } + +/** Identifies one or more objects used (or to be used) in the completion of + * an {@link Activity}. + * + */ + + async* getInstruments( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + for (let i = 0; i < vs.length; i++) { + let v = vs[i]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInstrument(v, options); + if (fetched == null) continue; + vs[i] = fetched; + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "instrument" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "instrument"]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + v = await this.#instrument_fromJsonLd(obj, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + continue; + } + yield v; + } + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: "expand", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { "@list": unknown[] } | string + >; + + array = []; + for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + const element = ( + v instanceof URL ? { "@id": v.href } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#actor"] = propValue; + + } + + array = []; + for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#object"] = propValue; + + } + + array = []; + for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#target"] = propValue; + + } + + array = []; + for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#result"] = propValue; + + } + + array = []; + for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#origin"] = propValue; + + } + + array = []; + for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#instrument"] = propValue; + + } + + values["@type"] = ["https://www.w3.org/ns/activitystreams#Activity"]; + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if ("proof" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element["@context"] = docContext; + } + } else { + compacted.proof["@context"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__Activity__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__Activity__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (values["@type"].includes("http://litepub.social/ns#EmojiReact")) { + return await EmojiReact.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#AnnounceRequest")) { + return await AnnounceRequest.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#LikeRequest")) { + return await LikeRequest.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://gotosocial.org/ns#ReplyRequest")) { + return await ReplyRequest.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) { + return await Accept.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeAccept")) { + return await TentativeAccept.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Add")) { + return await Add.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Announce")) { + return await Announce.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Create")) { + return await Create.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Delete")) { + return await Delete.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Dislike")) { + return await Dislike.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Flag")) { + return await Flag.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Follow")) { + return await Follow.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) { + return await Ignore.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) { + return await Block.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#IntransitiveActivity")) { + return await IntransitiveActivity.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Arrive")) { + return await Arrive.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Question")) { + return await Question.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Travel")) { + return await Travel.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Join")) { + return await Join.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Leave")) { + return await Leave.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Like")) { + return await Like.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Listen")) { + return await Listen.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Move")) { + return await Move.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Offer")) { + return await Offer.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Invite")) { + return await Invite.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Read")) { + return await Read.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Reject")) { + return await Reject.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeReject")) { + return await TentativeReject.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Remove")) { + return await Remove.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Undo")) { + return await Undo.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Update")) { + return await Update.fromJsonLd(json, options); + } + + if (values["@type"].includes("https://www.w3.org/ns/activitystreams#View")) { + return await View.fromJsonLd(json, options); + } + + if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + delete values["@type"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof Activity)) { + throw new TypeError("Unexpected type: " + instance.constructor.name); + } + + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + + let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values["https://www.w3.org/ns/activitystreams#actor"]; + + for ( + const v of _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array == null + ? [] + : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array.length === 1 && "@list" in _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0] + ? _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0]["@list"] + : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + + const decoded = + typeof v === "object" && "@type" in v + && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + ) : typeof v === "object" && "@type" in v + && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + ) : typeof v === "object" && "@type" in v + && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + ) : typeof v === "object" && "@type" in v + && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + ) : typeof v === "object" && "@type" in v + && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + ) : undefined + ; + if (typeof decoded === "undefined") continue; + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); + + } + instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + + let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values["https://www.w3.org/ns/activitystreams#object"]; + + for ( + const v of _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array == null + ? [] + : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array.length === 1 && "@list" in _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0] + ? _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0]["@list"] + : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + + const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + + let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values["https://www.w3.org/ns/activitystreams#target"]; + + for ( + const v of _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array == null + ? [] + : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array.length === 1 && "@list" in _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0] + ? _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0]["@list"] + : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + + const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + + let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values["https://www.w3.org/ns/activitystreams#result"]; + + for ( + const v of _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array == null + ? [] + : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array.length === 1 && "@list" in _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0] + ? _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0]["@list"] + : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + + const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + + let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values["https://www.w3.org/ns/activitystreams#origin"]; + + for ( + const v of _25zu2s3VxVujgEKqrDycjE284XQR_origin__array == null + ? [] + : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array.length === 1 && "@list" in _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0] + ? _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0]["@list"] + : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + + const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + + let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values["https://www.w3.org/ns/activitystreams#instrument"]; + + for ( + const v of _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array == null + ? [] + : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array.length === 1 && "@list" in _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0] + ? _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0]["@list"] + : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length == 1) { + proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; + } + + if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 1 + || !("actor" in proxy) + && _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 0) { + proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + } + + const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length == 1) { + proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; + } + + if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 1 + || !("object" in proxy) + && _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 0) { + proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + } + + const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length == 1) { + proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; + } + + if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 1 + || !("target" in proxy) + && _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 0) { + proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + } + + const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length == 1) { + proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; + } + + if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 1 + || !("result" in proxy) + && _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 0) { + proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + } + + const _25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length == 1) { + proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + } + + if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 1 + || !("origin" in proxy) + && _25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 0) { + proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + } + + const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length == 1) { + proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + } + + if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 1 + || !("instrument" in proxy) + && _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 0) { + proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(Activity.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: Activity, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Activity " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(Activity.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: Activity, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Activity " + inspect(proxy, options); + }; + /** Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0). + * + */ +export class EmojiReact extends Activity { + + /** + * The type URI of {@link EmojiReact}: \`http://litepub.social/ns#EmojiReact\`. + */ + static override get typeId(): URL { + return new URL("http://litepub.social/ns#EmojiReact"); + } + + /** + * Constructs a new instance of EmojiReact with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): EmojiReact { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as EmojiReact; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: "expand", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { "@list": unknown[] } | string + >; + + values["@type"] = ["http://litepub.social/ns#EmojiReact"]; + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"litepub":"http://litepub.social/ns#","toot":"http://joinmastodon.org/ns#","EmojiReact":"litepub:EmojiReact","Emoji":"toot:Emoji"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if ("proof" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element["@context"] = docContext; + } + } else { + compacted.proof["@context"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__EmojiReact__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__EmojiReact__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("http://litepub.social/ns#EmojiReact")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + delete values["@type"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof EmojiReact)) { + throw new TypeError("Unexpected type: " + instance.constructor.name); + } + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(EmojiReact.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: EmojiReact, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "EmojiReact " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(EmojiReact.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: EmojiReact, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "EmojiReact " + inspect(proxy, options); + }; + /** A pair of property name and value. + */ +export class PropertyValue { + + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. + */ + static get typeId(): URL { + return new URL("http://schema.org#PropertyValue"); + } + #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; +#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + + /** + * Constructs a new instance of PropertyValue with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if ("$warning" in options) { + this.#warning = options.$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError("The id must be a URL."); + } + + if ("name" in values && values.name != null) { + if (typeof values.name === "string" || values.name instanceof LanguageString) { + // @ts-ignore: type is checked above. + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; + + } else { + throw new TypeError( + "The name must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("value" in values && values.value != null) { + if (typeof values.value === "string" || values.value instanceof LanguageString) { + // @ts-ignore: type is checked above. + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; + + } else { + throw new TypeError( + "The value must be of type " + + "string | LanguageString" + ".", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + clone( + values: + { +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): PropertyValue { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: PropertyValue = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + if ("name" in values && values.name != null) { + if (typeof values.name === "string" || values.name instanceof LanguageString) { + // @ts-ignore: type is checked above. + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; + + } else { + throw new TypeError( + "The name must be of type " + + "string | LanguageString" + ".", + ); + } + } + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if ("value" in values && values.value != null) { + if (typeof values.value === "string" || values.value instanceof LanguageString) { + // @ts-ignore: type is checked above. + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; + + } else { + throw new TypeError( + "The value must be of type " + + "string | LanguageString" + ".", + ); + } + } + + return clone; + } + +/** The name of a property. + */ + get name(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) return null; + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + } + +/** The value of a property. + */ + get value(): (string | LanguageString | null) { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1) return null; + return this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + if (options.format == null && this.isCompactable()) { + const result: Record = {}; + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const item = ( + typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.locale.baseName, } - - const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length == 1) { - proxy.updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + ); + compactItems.push(item); } + if (compactItems.length > 0) { - const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length == 1) { - proxy.url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + result["name"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } - if (_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 1 - || !("url" in proxy) - && _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length > 0) { - proxy.urls = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + compactItems = []; + for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + const item = ( + typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.locale.baseName, } - - const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length == 1) { - proxy.to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + ); + compactItems.push(item); } + if (compactItems.length > 0) { - if (_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 1 - || !("to" in proxy) - && _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length > 0) { - proxy.tos = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + result["value"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } - const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); + result["type"] = "PropertyValue"; + if (this.id != null) result["id"] = this.id.href; + result["@context"] = ["https://www.w3.org/ns/activitystreams",{"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}]; + return result; + } - if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length == 1) { - proxy.bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; - } - - if (_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 1 - || !("bto" in proxy) - && _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length > 0) { - proxy.btos = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + const element = ( + typeof v === "string" ? { "@value": v } : { + "@value": v.toString(), + "@language": v.locale.baseName, } - - const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://www.w3.org/ns/activitystreams#name"] = propValue; - if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length == 1) { - proxy.cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; - } - - if (_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 1 - || !("cc" in proxy) - && _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length > 0) { - proxy.ccs = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; - } - - const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); + } - if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length == 1) { - proxy.bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + array = []; + for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + const element = ( + typeof v === "string" ? { "@value": v } : { + "@value": v.toString(), + "@language": v.locale.baseName, } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["http://schema.org#value"] = propValue; + + } + + values["@type"] = ["http://schema.org#PropertyValue"]; + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + ["https://www.w3.org/ns/activitystreams",{"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + if ( + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 + ) return false; - if (_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 1 - || !("bcc" in proxy) - && _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length > 0) { - proxy.bccs = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; - } + if ( + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null && + this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0 + ) return false; - const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__PropertyValue__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__PropertyValue__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("http://schema.org#PropertyValue")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + const instance = new this( + { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + options, + ); + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; + + let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values["https://www.w3.org/ns/activitystreams#name"]; - if (_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length == 1) { - proxy.mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; - } + for ( + const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null + ? [] + : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && "@list" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] + ? _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0]["@list"] + : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array + ) { + if (v == null) continue; + + const decoded = + typeof v === "object" && "@value" in v + && typeof v["@value"] === "string" && !("@language" in v) ? v["@value"] : typeof v === "object" && "@language" in v && "@value" in v + && typeof v["@language"] === "string" + && typeof v["@value"] === "string" ? new LanguageString(v["@value"], v["@language"]) : undefined + ; + if (typeof decoded === "undefined") continue; + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.push(decoded); - const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); + } + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + + let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values["http://schema.org#value"]; - if (_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length == 1) { - proxy.duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; - } + for ( + const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null + ? [] + : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && "@list" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] + ? _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0]["@list"] + : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array + ) { + if (v == null) continue; + + const decoded = + typeof v === "object" && "@value" in v + && typeof v["@value"] === "string" && !("@language" in v) ? v["@value"] : typeof v === "object" && "@language" in v && "@value" in v + && typeof v["@language"] === "string" + && typeof v["@value"] === "string" ? new LanguageString(v["@value"], v["@language"]) : undefined + ; + if (typeof decoded === "undefined") continue; + _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.push(decoded); - const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); + } + instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - if (_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length == 1) { - proxy.sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); } - - const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(this.id!.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(this.id!.href, options), + }; + } + + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -11105,11 +17476,11 @@ get urls(): ((URL | Link))[] { } : v); - if (_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length == 1) { - proxy.source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; } - const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -11125,14 +17496,8 @@ get urls(): ((URL | Link))[] { } : v); - if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length == 1) { - proxy.proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; - } - - if (_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 1 - || !("proof" in proxy) - && _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length > 0) { - proxy.proofs = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + if (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { + proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; } return proxy; @@ -11141,40 +17506,55 @@ get urls(): ((URL | Link))[] { // deno-lint-ignore no-explicit-any -(Object.prototype as any)[Symbol.for("Deno.customInspect")] = +(PropertyValue.prototype as any)[Symbol.for("Deno.customInspect")] = function ( - this: Object, + this: PropertyValue, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return "Object " + inspect(proxy, options); + return "PropertyValue " + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Object.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = +(PropertyValue.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = function ( - this: Object, + this: PropertyValue, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return "Object " + inspect(proxy, options); + return "PropertyValue " + inspect(proxy, options); }; - /** Represents a custom emoji. + /** Proves that an {@link Announce} interaction has been approved by + * the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that an announce (boost) was authorized. The \`attributedTo\` property + * identifies the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * */ -export class Emoji extends Object { +export class AnnounceAuthorization extends Object { /** - * The type URI of {@link Emoji}: \`http://joinmastodon.org/ns#Emoji\`. + * The type URI of {@link AnnounceAuthorization}: \`https://gotosocial.org/ns#AnnounceAuthorization\`. */ static override get typeId(): URL { - return new URL("http://joinmastodon.org/ns#Emoji"); + return new URL("https://gotosocial.org/ns#AnnounceAuthorization"); } + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + /** - * Constructs a new instance of Emoji with the given values. + * Constructs a new instance of AnnounceAuthorization with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -11198,7 +17578,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -11206,7 +17586,33 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, } = {}, ) { - super(values, options);} + super(values, options); + if ("interactingObject" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + } else { + throw new TypeError( + "The interactingObject must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("interactionTarget" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + } else { + throw new TypeError( + "The interactionTarget must be of type " + + "Object | URL" + ".", + ); + } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -11234,14 +17640,14 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): Emoji { + ): AnnounceAuthorization { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -11250,10 +17656,467 @@ proofs?: (DataIntegrityProof | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Emoji; + const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if ("interactingObject" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + } else { + throw new TypeError( + "The interactingObject must be of type " + + "Object | URL" + ".", + ); + } + } + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if ("interactionTarget" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + } else { + throw new TypeError( + "The interactionTarget must be of type " + + "Object | URL" + ".", + ); + } + } + return clone; } + async #fetchInteractingObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactingObject_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactingObject_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link AnnounceAuthorization.getInteractingObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactingObjectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the interaction (e.g., an {@link Announce} activity) that + * has been authorized. + * + */ + + async getInteractingObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "interactingObject" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "interactingObject"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + + async #fetchInteractionTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactionTarget_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactionTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link AnnounceAuthorization.getInteractionTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactionTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the post that is the target of the authorized announce. + * + */ + + async getInteractionTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractionTarget(v, options); + if (fetched == null) return null; + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "interactionTarget" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "interactionTarget"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#interactionTarget_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -11294,9 +18157,49 @@ proofs?: (DataIntegrityProof | URL)[];} // deno-lint-ignore no-unused-vars let compactItems: unknown[]; - result["type"] = "Emoji"; + compactItems = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["interactingObject"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["interactionTarget"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result["type"] = "AnnounceAuthorization"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -11313,7 +18216,37 @@ proofs?: (DataIntegrityProof | URL)[];} unknown[] | { "@list": unknown[] } | string >; - values["@type"] = ["http://joinmastodon.org/ns#Emoji"]; + array = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#interactingObject"] = propValue; + + } + + array = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const element = ( + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#interactionTarget"] = propValue; + + } + + values["@type"] = ["https://gotosocial.org/ns#AnnounceAuthorization"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { return await jsonld.expand( @@ -11322,7 +18255,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -11370,7 +18303,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( "@fedify/vocab-tools", @@ -11380,7 +18313,7 @@ proofs?: (DataIntegrityProof | URL)[];} "activitypub.parse_object", async (span) => { try { - const object = await this.__fromJsonLd__Emoji__( + const object = await this.__fromJsonLd__AnnounceAuthorization__( json, span, options); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); @@ -11399,7 +18332,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } - protected static async __fromJsonLd__Emoji__( + protected static async __fromJsonLd__AnnounceAuthorization__( json: unknown, span: Span, options: { @@ -11408,7 +18341,7 @@ proofs?: (DataIntegrityProof | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); } @@ -11442,7 +18375,7 @@ proofs?: (DataIntegrityProof | URL)[];} if ("@type" in values && !values["@type"].every(t => t.startsWith("_:"))) { - if (!values["@type"].includes("http://joinmastodon.org/ns#Emoji")) { + if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) { throw new TypeError("Invalid type: " + values["@type"]); } } @@ -11453,10 +18386,70 @@ proofs?: (DataIntegrityProof | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof Emoji)) { + if (!(instance instanceof AnnounceAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; + + for ( + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null + ? [] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; + + for ( + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null + ? [] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array + ) { + if (v == null) continue; + + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -11472,52 +18465,97 @@ proofs?: (DataIntegrityProof | URL)[];} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + } + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + } + return proxy; } } // deno-lint-ignore no-explicit-any -(Emoji.prototype as any)[Symbol.for("Deno.customInspect")] = +(AnnounceAuthorization.prototype as any)[Symbol.for("Deno.customInspect")] = function ( - this: Emoji, + this: AnnounceAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return "Emoji " + inspect(proxy, options); + return "AnnounceAuthorization " + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Emoji.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = +(AnnounceAuthorization.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = function ( - this: Emoji, + this: AnnounceAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return "Emoji " + inspect(proxy, options); + return "AnnounceAuthorization " + inspect(proxy, options); }; - /** \`ChatMessage\`s are the messages sent in 1-on-1 chats. They are similar to - * {@link Note}s, but the addressing is done by having a single AP actor in - * the \`to\` field. Addressing multiple actors is not allowed. These messages - * are always private, there is no public version of them. They are created with - * a {@link Create} activity. + /** A request to announce (boost) a post that requires approval from + * the post author. + * + * The \`object\` property references the post to be announced, and + * the \`instrument\` property contains the {@link Announce} activity itself. + * + * The post author responds with an {@link Accept} (with an + * {@link AnnounceAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class ChatMessage extends Object { +export class AnnounceRequest extends Activity { /** - * The type URI of {@link ChatMessage}: \`http://litepub.social/ns#ChatMessage\`. + * The type URI of {@link AnnounceRequest}: \`https://gotosocial.org/ns#AnnounceRequest\`. */ static override get typeId(): URL { - return new URL("http://litepub.social/ns#ChatMessage"); + return new URL("https://gotosocial.org/ns#AnnounceRequest"); } - #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; - + /** - * Constructs a new instance of ChatMessage with the given values. + * Constructs a new instance of AnnounceRequest with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -11541,7 +18579,13 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} , options: { documentLoader?: DocumentLoader, @@ -11549,20 +18593,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, } = {}, ) { - super(values, options); - if ("quoteUrl" in values && values.quoteUrl != null) { - if (values.quoteUrl instanceof URL) { - // @ts-ignore: type is checked above. - this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; - - } else { - throw new TypeError( - "The quoteUrl must be of type " + - "URL" + ".", - ); - } - } - } + super(values, options);} /** * Clones this instance, optionally updating it with the given values. @@ -11590,14 +18621,20 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): ChatMessage { + ): AnnounceRequest { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -11606,46 +18643,10 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; - if ("quoteUrl" in values && values.quoteUrl != null) { - if (values.quoteUrl instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = [values.quoteUrl]; - - } else { - throw new TypeError( - "The quoteUrl must be of type " + - "URL" + ".", - ); - } - } - + const clone = super.clone(values, options) as unknown as AnnounceRequest; return clone; } -/** The URI of the ActivityStreams object that this object quotes. - * - * This property sets three JSON-LD properties at once under the hood: - * - * 1. https://www.w3.org/ns/activitystreams#quoteUrl - * 2. https://misskey-hub.net/ns#_misskey_quote - * 3. http://fedibird.com/ns#quoteUri - * - * When a JSON-LD object is parsed, this property is filled with one of - * the values of those three properties in order. - * - */ - get quoteUrl(): (URL | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < 1) return null; - return this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -11675,49 +18676,6 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} contextLoader: options.contextLoader ?? getDocumentLoader(), }; - if (options.format == null && this.isCompactable()) { - - const result = await super.toJsonLd({ - ...options, - format: undefined, - context: undefined, - }) as Record; - - // deno-lint-ignore no-unused-vars - let compactItems: unknown[]; - - compactItems = []; - for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const item = ( - v.href - ); - compactItems.push(item); - } - if (compactItems.length > 0) { - - result["quoteUrl"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result["_misskey_quote"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result["quoteUri"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - } - - result["type"] = "ChatMessage"; - if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","Emoji":"toot:Emoji","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; - return result; - } - // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; @@ -11731,26 +18689,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} unknown[] | { "@list": unknown[] } | string >; - array = []; - for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const element = ( - { "@value": v.href } - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#quoteUrl"] = propValue; - - values["https://misskey-hub.net/ns#_misskey_quote"] = propValue; - - values["http://fedibird.com/ns#quoteUri"] = propValue; - - } - - values["@type"] = ["http://litepub.social/ns#ChatMessage"]; + values["@type"] = ["https://gotosocial.org/ns#AnnounceRequest"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { return await jsonld.expand( @@ -11759,7 +18698,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","Emoji":"toot:Emoji","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -11807,7 +18746,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( "@fedify/vocab-tools", @@ -11817,7 +18756,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} "activitypub.parse_object", async (span) => { try { - const object = await this.__fromJsonLd__ChatMessage__( + const object = await this.__fromJsonLd__AnnounceRequest__( json, span, options); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); @@ -11836,7 +18775,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } - protected static async __fromJsonLd__ChatMessage__( + protected static async __fromJsonLd__AnnounceRequest__( json: unknown, span: Span, options: { @@ -11845,7 +18784,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); } @@ -11879,7 +18818,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} if ("@type" in values && !values["@type"].every(t => t.startsWith("_:"))) { - if (!values["@type"].includes("http://litepub.social/ns#ChatMessage")) { + if (!values["@type"].includes("https://gotosocial.org/ns#AnnounceRequest")) { throw new TypeError("Invalid type: " + values["@type"]); } } @@ -11890,32 +18829,9 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof ChatMessage)) { + if (!(instance instanceof AnnounceRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; - - let _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["https://www.w3.org/ns/activitystreams#quoteUrl"]; - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["https://misskey-hub.net/ns#_misskey_quote"]; - } - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) { - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"]; - } - - 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 - ) { - if (v == null) continue; - _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v["@value"])) - } - instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; if (!("_fromSubclass" in options) || !options._fromSubclass) { try { @@ -11932,363 +18848,161 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); - const _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length == 1) { - proxy.quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[0]; - } - return proxy; } } // deno-lint-ignore no-explicit-any -(ChatMessage.prototype as any)[Symbol.for("Deno.customInspect")] = +(AnnounceRequest.prototype as any)[Symbol.for("Deno.customInspect")] = function ( - this: ChatMessage, + this: AnnounceRequest, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return "ChatMessage " + inspect(proxy, options); + return "AnnounceRequest " + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(ChatMessage.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = +(AnnounceRequest.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = function ( - this: ChatMessage, + this: AnnounceRequest, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return "ChatMessage " + inspect(proxy, options); + return "AnnounceRequest " + inspect(proxy, options); }; - /** An Activity is a subtype of {@link Object} that describes some form of action - * that may happen, is currently happening, or has already happened. - * The {@link Activity} type itself serves as an abstract base type for all types - * of activities. It is important to note that the {@link Activity} type itself - * does not carry any specific semantics about the kind of action being taken. + /** Represents an interaction policy attached to a post, specifying who can + * like, reply to, or announce it. Each sub-policy ({@link InteractionRule}) + * defines which actors receive automatic or manual approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class Activity extends Object { +export class InteractionPolicy { + + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + /** - * The type URI of {@link Activity}: \`https://www.w3.org/ns/activitystreams#Activity\`. + * The type URI of {@link InteractionPolicy}: \`https://gotosocial.org/ns#InteractionPolicy\`. */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Activity"); + static get typeId(): URL { + return new URL("https://gotosocial.org/ns#InteractionPolicy"); } - - #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); - - #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); - - #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); - - #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); - - #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); - - #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); - - /** - * Constructs a new instance of Activity with the given values. - * @param values The values to initialize the instance with. - * @param options The options to use for initialization. - */ - constructor( - values: - { -id?: URL | null; -attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; -attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; -audiences?: (Object | URL)[];content?: string | LanguageString | null; -contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; -names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; -icons?: (Image | URL)[];image?: Image | URL | null; -images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; -replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; -locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; -previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; -summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; -urls?: ((URL | Link))[];to?: Object | URL | null; -tos?: (Object | URL)[];bto?: Object | URL | null; -btos?: (Object | URL)[];cc?: Object | URL | null; -ccs?: (Object | URL)[];bcc?: Object | URL | null; -bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; -actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; -objects?: (Object | URL)[];target?: Object | URL | null; -targets?: (Object | URL)[];result?: Object | URL | null; -results?: (Object | URL)[];origin?: Object | URL | null; -origins?: (Object | URL)[];instrument?: Object | URL | null; -instruments?: (Object | URL)[];} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } = {}, - ) { - super(values, options); - if ("actor" in values && values.actor != null) { - if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); - } else { - throw new TypeError( - "The actor must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("actors" in values && values.actors != null) { - - if ("actor" in values && - values.actor != null) { - throw new TypeError( - "Cannot initialize both actor and " + - "actors at the same time.", - ); - } - - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; - - for (let i = 0; i < values.actors.length; i++) { - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } - - } else { - throw new TypeError( - "The actors must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("object" in values && values.object != null) { - if (values.object instanceof Object || values.object instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); - } else { - throw new TypeError( - "The object must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("objects" in values && values.objects != null) { - - if ("object" in values && - values.object != null) { - throw new TypeError( - "Cannot initialize both object and " + - "objects at the same time.", - ); - } - - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; - - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } - - } else { - throw new TypeError( - "The objects must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("target" in values && values.target != null) { - if (values.target instanceof Object || values.target instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); - } else { - throw new TypeError( - "The target must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("targets" in values && values.targets != null) { - - if ("target" in values && - values.target != null) { - throw new TypeError( - "Cannot initialize both target and " + - "targets at the same time.", - ); - } - - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; - - for (let i = 0; i < values.targets.length; i++) { - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } - - } else { - throw new TypeError( - "The targets must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("result" in values && values.result != null) { - if (values.result instanceof Object || values.result instanceof URL) { - // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); - } else { - throw new TypeError( - "The result must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("results" in values && values.results != null) { - - if ("result" in values && - values.result != null) { - throw new TypeError( - "Cannot initialize both result and " + - "results at the same time.", - ); - } - - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + #_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; +#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply: (InteractionRule)[] = []; +#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce: (InteractionRule)[] = []; + + /** + * Constructs a new instance of InteractionPolicy with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if ("$warning" in options) { + this.#warning = options.$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError("The id must be a URL."); + } + + if ("canLike" in values && values.canLike != null) { + if (values.canLike instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; - - for (let i = 0; i < values.results.length; i++) { - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } - - } else { - throw new TypeError( - "The results must be an array of type " + - "Object | URL" + ".", - ); - } - } + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = [values.canLike]; - if ("origin" in values && values.origin != null) { - if (values.origin instanceof Object || values.origin instanceof URL) { - // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); } else { throw new TypeError( - "The origin must be of type " + - "Object | URL" + ".", + "The canLike must be of type " + + "InteractionRule" + ".", ); } } - if ("origins" in values && values.origins != null) { - - if ("origin" in values && - values.origin != null) { - throw new TypeError( - "Cannot initialize both origin and " + - "origins at the same time.", - ); - } - - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + if ("canReply" in values && values.canReply != null) { + if (values.canReply instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; - - for (let i = 0; i < values.origins.length; i++) { - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } - - } else { - throw new TypeError( - "The origins must be an array of type " + - "Object | URL" + ".", - ); - } - } + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = [values.canReply]; - if ("instrument" in values && values.instrument != null) { - if (values.instrument instanceof Object || values.instrument instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); } else { throw new TypeError( - "The instrument must be of type " + - "Object | URL" + ".", + "The canReply must be of type " + + "InteractionRule" + ".", ); } } - if ("instruments" in values && values.instruments != null) { - - if ("instrument" in values && - values.instrument != null) { - throw new TypeError( - "Cannot initialize both instrument and " + - "instruments at the same time.", - ); - } - - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + if ("canAnnounce" in values && values.canAnnounce != null) { + if (values.canAnnounce instanceof InteractionRule) { // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = [values.canAnnounce]; - for (let i = 0; i < values.instruments.length; i++) { - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } - } else { throw new TypeError( - "The instruments must be an array of type " + - "Object | URL" + ".", + "The canAnnounce must be of type " + + "InteractionRule" + ".", ); } } @@ -12300,40 +19014,18 @@ instruments?: (Object | URL)[];} * @param options The options to use for cloning. * @returns The cloned instance. */ - override clone( + clone( values: { id?: URL | null; -attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; -attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; -audiences?: (Object | URL)[];content?: string | LanguageString | null; -contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; -names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; -icons?: (Image | URL)[];image?: Image | URL | null; -images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; -replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; -locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; -previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; -summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; -urls?: ((URL | Link))[];to?: Object | URL | null; -tos?: (Object | URL)[];bto?: Object | URL | null; -btos?: (Object | URL)[];cc?: Object | URL | null; -ccs?: (Object | URL)[];bcc?: Object | URL | null; -bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; -actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; -objects?: (Object | URL)[];target?: Object | URL | null; -targets?: (Object | URL)[];result?: Object | URL | null; -results?: (Object | URL)[];origin?: Object | URL | null; -origins?: (Object | URL)[];instrument?: Object | URL | null; -instruments?: (Object | URL)[];} +canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): Activity { + ): InteractionPolicy { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -12342,1555 +19034,1352 @@ instruments?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor;clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); - if ("actor" in values && values.actor != null) { - if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); - } else { - throw new TypeError( - "The actor must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("actors" in values && values.actors != null) { - - if ("actor" in values && - values.actor != null) { - throw new TypeError( - "Cannot update both actor and " + - "actors at the same time.", - ); - } - - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors; - - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); - for (let i = 0; i < values.actors.length; i++) { - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } - - } else { - throw new TypeError( - "The actors must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object;clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); - if ("object" in values && values.object != null) { - if (values.object instanceof Object || values.object instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); - } else { - throw new TypeError( - "The object must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("objects" in values && values.objects != null) { - - if ("object" in values && - values.object != null) { - throw new TypeError( - "Cannot update both object and " + - "objects at the same time.", - ); - } - - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects; - - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } - - } else { - throw new TypeError( - "The objects must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target;clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); - if ("target" in values && values.target != null) { - if (values.target instanceof Object || values.target instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); - } else { - throw new TypeError( - "The target must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("targets" in values && values.targets != null) { - - if ("target" in values && - values.target != null) { - throw new TypeError( - "Cannot update both target and " + - "targets at the same time.", - ); - } - - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets; - - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); - for (let i = 0; i < values.targets.length; i++) { - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } - - } else { - throw new TypeError( - "The targets must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result;clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); - if ("result" in values && values.result != null) { - if (values.result instanceof Object || values.result instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); - } else { - throw new TypeError( - "The result must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("results" in values && values.results != null) { - - if ("result" in values && - values.result != null) { - throw new TypeError( - "Cannot update both result and " + - "results at the same time.", - ); - } - - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results; - - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); - for (let i = 0; i < values.results.length; i++) { - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } - - } else { - throw new TypeError( - "The results must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin;clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); - if ("origin" in values && values.origin != null) { - if (values.origin instanceof Object || values.origin instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); - } else { - throw new TypeError( - "The origin must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("origins" in values && values.origins != null) { - - if ("origin" in values && - values.origin != null) { - throw new TypeError( - "Cannot update both origin and " + - "origins at the same time.", - ); - } - - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins; - - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); - for (let i = 0; i < values.origins.length; i++) { - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } - - } else { - throw new TypeError( - "The origins must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument;clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); - if ("instrument" in values && values.instrument != null) { - if (values.instrument instanceof Object || values.instrument instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); - } else { - throw new TypeError( - "The instrument must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("instruments" in values && values.instruments != null) { - - if ("instrument" in values && - values.instrument != null) { - throw new TypeError( - "Cannot update both instrument and " + - "instruments at the same time.", - ); - } - - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments; - - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); - for (let i = 0; i < values.instruments.length; i++) { - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } - - } else { - throw new TypeError( - "The instruments must be an array of type " + - "Object | URL" + ".", - ); - } - } - - return clone; - } - async #fetchActor( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/vocab-tools", - "0.0.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to fetch {url}: {error}", - { error, url: url.href } - ); - return null; - } - throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#actor_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== "trust" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === "throw") { - throw new Error( - "The object's @id (" + obj.id.href + ") has a different origin " + - "than the document URL (" + baseUrl.href + "); 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".' - ); - } - getLogger(["fedify", "vocab"]).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".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute("activitypub.object.id", (obj.id ?? url).href); - span.setAttribute( - "activitypub.object.type", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to parse {url}: {error}", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); - } - }); - } - - async #actor_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: InteractionPolicy = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + if ("canLike" in values && values.canLike != null) { + if (values.canLike instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = [values.canLike]; - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; + } else { + throw new TypeError( + "The canLike must be of type " + + "InteractionRule" + ".", + ); + } } + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + if ("canReply" in values && values.canReply != null) { + if (values.canReply instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = [values.canReply]; - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; + } else { + throw new TypeError( + "The canReply must be of type " + + "InteractionRule" + ".", + ); + } } + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + if ("canAnnounce" in values && values.canAnnounce != null) { + if (values.canAnnounce instanceof InteractionRule) { + // @ts-ignore: type is checked above. + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = [values.canAnnounce]; - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Service"].join(", ")); - } - - - /** - * Similar to - * {@link Activity.getActor}, - * but returns its \`@id\` URL instead of the object itself. - */ - get actorId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + } else { + throw new TypeError( + "The canAnnounce must be of type " + + "InteractionRule" + ".", + ); + } } - if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; - const v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - if (v instanceof URL) return v; - return v.id; - } -/** Describes one or more entities that either performed or are expected to - * perform the activity. Any single activity can have multiple actors. - * The actor MAY be specified using an indirect {@link Link}. + return clone; + } + +/** The sub-policy specifying who can like the post. + * + * When absent, implementations should assume that anyone can like the post + * (i.e., \`automaticApproval\` defaults to the public collection). * */ - - async getActor( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): Promise { + get canLike(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < 1) return null; - let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) return null; - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "actor" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "actor"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#actor_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; + if (this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length < 1) return null; + return this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[0]; } - /** - * Similar to - * {@link Activity.getActors}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get actorIds(): URL[] { +/** The sub-policy specifying who can reply to the post. + * + * When absent, implementations should assume that anyone can reply + * (i.e., \`automaticApproval\` defaults to the public collection). + * + */ + get canReply(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + if (this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length < 1) return null; + return this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[0]; } -/** Describes one or more entities that either performed or are expected to - * perform the activity. Any single activity can have multiple actors. - * The actor MAY be specified using an indirect {@link Link}. +/** The sub-policy specifying who can announce (boost) the post. + * + * When absent, implementations should assume that anyone can announce + * (i.e., \`automaticApproval\` defaults to the public collection). * */ - - async* getActors( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { + get canAnnounce(): (InteractionRule | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "actor" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "actor"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#actor_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } + if (this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length < 1) return null; + return this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[0]; } - async #fetchObject( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/vocab-tools", - "0.0.0", + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { - let fetchResult: RemoteDocument; + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#canLike"] = propValue; + + } + + array = []; + for (const v of this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#canReply"] = propValue; + + } + + array = []; + for (const v of this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + const element = ( + await v.toJsonLd(options) + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#canAnnounce"] = propValue; + + } + + + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + "https://gotosocial.org/ns"; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + if ( + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike != null && + this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length > 0 + ) return false; + + if ( + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply != null && + this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length > 0 + ) return false; + + if ( + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce != null && + this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length > 0 + ) return false; + + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { try { - fetchResult = await documentLoader(url.href); + const object = await this.__fromJsonLd__InteractionPolicy__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; } catch (error) { span.setStatus({ code: SpanStatusCode.ERROR, message: String(error), }); - span.end(); - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to fetch {url}: {error}", - { error, url: url.href } - ); - return null; - } throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#object_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== "trust" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === "throw") { - throw new Error( - "The object's @id (" + obj.id.href + ") has a different origin " + - "than the document URL (" + baseUrl.href + "); 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".' - ); - } - getLogger(["fedify", "vocab"]).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".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute("activitypub.object.id", (obj.id ?? url).href); - span.setAttribute( - "activitypub.object.type", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to parse {url}: {error}", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; } finally { span.end(); } + }, + ); + } + + protected static async __fromJsonLd__InteractionPolicy__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("https://gotosocial.org/ns#InteractionPolicy")) { + throw new TypeError("Invalid type: " + values["@type"]); } + } + + const instance = new this( + { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + options, + ); + const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; - async #object_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; + let _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array = values["https://gotosocial.org/ns#canLike"]; - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + for ( + const v of _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array == null + ? [] + : _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array.length === 1 && "@list" in _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array[0] + ? _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array[0]["@list"] + : _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike__array + ) { + if (v == null) continue; + _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + const _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply: (InteractionRule)[] = []; + + let _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array = values["https://gotosocial.org/ns#canReply"]; + + for ( + const v of _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array == null + ? [] + : _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array.length === 1 && "@list" in _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array[0] + ? _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array[0]["@list"] + : _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply__array + ) { + if (v == null) continue; + _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) } + instance.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + const _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce: (InteractionRule)[] = []; + let _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array = values["https://gotosocial.org/ns#canAnnounce"]; - /** - * Similar to - * {@link Activity.getObject}, - * but returns its \`@id\` URL instead of the object itself. - */ - get objectId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; - const v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - if (v instanceof URL) return v; - return v.id; + for ( + const v of _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array == null + ? [] + : _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array.length === 1 && "@list" in _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array[0] + ? _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array[0]["@list"] + : _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce__array + ) { + if (v == null) continue; + _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.push(await InteractionRule.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) + } + instance.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); + } + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(this.id!.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(this.id!.href, options), + }; + } + + const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length == 1) { + proxy.canLike = _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[0]; } -/** When used within an {@link Activity}, describes the direct object of - * the activity. For instance, in the activity "John added a movie to his - * wishlist", the object of the activity is the movie added. - * - */ - - async getObject( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < 1) return null; - let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) return null; - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "object" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "object"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#object_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; + const _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length == 1) { + proxy.canReply = _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[0]; } - /** - * Similar to - * {@link Activity.getObjects}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get objectIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + const _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length == 1) { + proxy.canAnnounce = _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[0]; } -/** When used within an {@link Activity}, describes the direct object of - * the activity. For instance, in the activity "John added a movie to his - * wishlist", the object of the activity is the movie added. + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(InteractionPolicy.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: InteractionPolicy, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "InteractionPolicy " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(InteractionPolicy.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: InteractionPolicy, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "InteractionPolicy " + inspect(proxy, options); + }; + /** Represents a sub-policy within an {@link InteractionPolicy}, defining which + * actors receive automatic or manual approval for a specific interaction type + * (like, reply, or announce). + * + * Valid values in the approval lists include: + * + * - The ActivityStreams public collection + * (\`https://www.w3.org/ns/activitystreams#Public\`) for anyone + * - The post author's \`followers\` or \`following\` collection URIs + * - Individual actor URIs + * + * When an actor appears in both \`automaticApproval\` and \`manualApproval\`, + * the more specific value takes precedence (individual URI overrides + * collection membership), and \`automaticApproval\` takes precedence over + * \`manualApproval\` for identical URIs. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ +export class InteractionRule { - async* getObjects( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; + + protected get _documentLoader(): DocumentLoader | undefined { + return this.#documentLoader; + } + + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } + + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } + + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } + + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link InteractionRule}: \`https://gotosocial.org/ns#InteractionRule\`. + */ + static get typeId(): URL { + return new URL("https://gotosocial.org/ns#InteractionRule"); + } + #_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; +#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval: (URL)[] = []; + + /** + * Constructs a new instance of InteractionRule with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + + this.#documentLoader = options.documentLoader; + this.#contextLoader = options.contextLoader; + this.#tracerProvider = options.tracerProvider; + if ("$warning" in options) { + this.#warning = options.$warning as unknown as { + category: string[]; + message: string; + values?: Record; + }; + } + if (values.id == null || values.id instanceof URL) { + this.id = values.id ?? null; + } else { + throw new TypeError("The id must be a URL."); + } + + if ("automaticApproval" in values && values.automaticApproval != null) { + if (values.automaticApproval instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = [values.automaticApproval]; - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "object" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "object"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#object_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } else { + throw new TypeError( + "The automaticApproval must be of type " + + "URL" + ".", ); - continue; } - yield v; } - } - async #fetchTarget( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/vocab-tools", - "0.0.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { - let fetchResult: RemoteDocument; - try { - fetchResult = await documentLoader(url.href); - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - span.end(); - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to fetch {url}: {error}", - { error, url: url.href } - ); - return null; - } - throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#target_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== "trust" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === "throw") { - throw new Error( - "The object's @id (" + obj.id.href + ") has a different origin " + - "than the document URL (" + baseUrl.href + "); 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".' - ); - } - getLogger(["fedify", "vocab"]).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".', - { ...fetchResult, objectId: obj.id.href }, + if ("automaticApprovals" in values && values.automaticApprovals != null) { + + if ("automaticApproval" in values && + values.automaticApproval != null) { + throw new TypeError( + "Cannot initialize both automaticApproval and " + + "automaticApprovals at the same time.", ); - return null; } - span.setAttribute("activitypub.object.id", (obj.id ?? url).href); - span.setAttribute( - "activitypub.object.type", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to parse {url}: {error}", - { error: e, url: url.href } + + if (Array.isArray(values.automaticApprovals) && + values.automaticApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals; + + } else { + throw new TypeError( + "The automaticApprovals must be an array of type " + + "URL" + ".", ); - return null; } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; - } finally { - span.end(); - } - }); - } - - async #target_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; } - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); - } - - - /** - * Similar to - * {@link Activity.getTarget}, - * but returns its \`@id\` URL instead of the object itself. - */ - get targetId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if ("manualApproval" in values && values.manualApproval != null) { + if (values.manualApproval instanceof URL) { + // @ts-ignore: type is checked above. + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = [values.manualApproval]; + + } else { + throw new TypeError( + "The manualApproval must be of type " + + "URL" + ".", + ); + } } - if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; - const v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - if (v instanceof URL) return v; - return v.id; - } -/** Describes the indirect object, or target, of the activity. The precise - * meaning of the target is largely dependent on the type of action being - * described but will often be the object of the English preposition "to". - * For instance, in the activity "John added a movie to his wishlist", - * the target of the activity is John's wishlist. An activity can have more - * than one target. - * - */ - - async getTarget( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if ("manualApprovals" in values && values.manualApprovals != null) { + + if ("manualApproval" in values && + values.manualApproval != null) { + throw new TypeError( + "Cannot initialize both manualApproval and " + + "manualApprovals at the same time.", + ); + } + + if (Array.isArray(values.manualApprovals) && + values.manualApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals; + + } else { + throw new TypeError( + "The manualApprovals must be an array of type " + + "URL" + ".", + ); + } } - if (this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < 1) return null; - let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - v = v.id; + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + clone( + values: + { +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): InteractionRule { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + + // @ts-ignore: this.constructor is not recognized as a constructor, but it is. + const clone: InteractionRule = new this.constructor( + { id: values.id ?? this.id }, + options + ); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + if ("automaticApproval" in values && values.automaticApproval != null) { + if (values.automaticApproval instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = [values.automaticApproval]; + + } else { + throw new TypeError( + "The automaticApproval must be of type " + + "URL" + ".", + ); + } } - if (v instanceof URL) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) return null; - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(0); - this._cachedJsonLd = undefined; - return fetched; + + if ("automaticApprovals" in values && values.automaticApprovals != null) { + + if ("automaticApproval" in values && + values.automaticApproval != null) { + throw new TypeError( + "Cannot update both automaticApproval and " + + "automaticApprovals at the same time.", + ); + } + + if (Array.isArray(values.automaticApprovals) && + values.automaticApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals; + + } else { + throw new TypeError( + "The automaticApprovals must be an array of type " + + "URL" + ".", + ); + } } + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + if ("manualApproval" in values && values.manualApproval != null) { + if (values.manualApproval instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = [values.manualApproval]; - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "target" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "target"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#target_fromJsonLd(doc, options); + } else { + throw new TypeError( + "The manualApproval must be of type " + + "URL" + ".", + ); } } + + if ("manualApprovals" in values && values.manualApprovals != null) { + + if ("manualApproval" in values && + values.manualApproval != null) { + throw new TypeError( + "Cannot update both manualApproval and " + + "manualApprovals at the same time.", + ); + } - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' + if (Array.isArray(values.manualApprovals) && + values.manualApprovals.every(v => v instanceof URL)) { + // @ts-ignore: type is checked above. + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals; + + } else { + throw new TypeError( + "The manualApprovals must be an array of type " + + "URL" + ".", ); } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; } - return v; - } - /** - * Similar to - * {@link Activity.getTargets}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get targetIds(): URL[] { + return clone; + } + +/** URIs of actors or collections whose interactions are automatically + * approved without requiring manual review by the post author. + * + */ + get automaticApproval(): (URL | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - return this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + if (this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < 1) return null; + return this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[0]; } -/** Describes the indirect object, or target, of the activity. The precise - * meaning of the target is largely dependent on the type of action being - * described but will often be the object of the English preposition "to". - * For instance, in the activity "John added a movie to his wishlist", - * the target of the activity is John's wishlist. An activity can have more - * than one target. +/** URIs of actors or collections whose interactions are automatically + * approved without requiring manual review by the post author. * */ - - async* getTargets( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { +get automaticApprovals(): (URL)[] { + return this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + } + +/** URIs of actors or collections whose interactions require manual approval + * by the post author. The post author can accept or reject these + * interactions at their discretion. + * + */ + get manualApproval(): (URL | null) { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - const vs = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } + if (this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length < 1) return null; + return this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[0]; + } - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "target" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "target"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#target_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } +/** URIs of actors or collections whose interactions require manual approval + * by the post author. The post author can accept or reject these + * interactions at their discretion. + * + */ +get manualApprovals(): (URL)[] { + return this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; } - async #fetchResult( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {}, - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/vocab-tools", - "0.0.0", + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { - let fetchResult: RemoteDocument; + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + const values: Record = {}; + array = []; + for (const v of this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + const element = ( + { "@id": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#automaticApproval"] = propValue; + + } + + array = []; + for (const v of this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + const element = ( + { "@id": v.href } + ); + array.push(element);; + } + if (array.length > 0) { + const propValue = ( + array + ); + values["https://gotosocial.org/ns#manualApproval"] = propValue; + + } + + + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + "https://gotosocial.org/ns"; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + } + return compacted; + } + + protected isCompactable(): boolean { + + return true; + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { try { - fetchResult = await documentLoader(url.href); + const object = await this.__fromJsonLd__InteractionRule__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; } catch (error) { span.setStatus({ code: SpanStatusCode.ERROR, message: String(error), }); - span.end(); - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to fetch {url}: {error}", - { error, url: url.href } - ); - return null; - } throw error; - } - const { document, documentUrl } = fetchResult; - const baseUrl = new URL(documentUrl); - try { - const obj = await this.#result_fromJsonLd( - document, - { documentLoader, contextLoader, tracerProvider, baseUrl } - ); - if (options.crossOrigin !== "trust" && obj?.id != null && - obj.id.origin !== baseUrl.origin) { - if (options.crossOrigin === "throw") { - throw new Error( - "The object's @id (" + obj.id.href + ") has a different origin " + - "than the document URL (" + baseUrl.href + "); 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".' - ); - } - getLogger(["fedify", "vocab"]).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".', - { ...fetchResult, objectId: obj.id.href }, - ); - return null; - } - span.setAttribute("activitypub.object.id", (obj.id ?? url).href); - span.setAttribute( - "activitypub.object.type", - // @ts-ignore: obj.constructor always has a typeId. - obj.constructor.typeId.href - ); - return obj; - } catch (e) { - if (options.suppressError) { - getLogger(["fedify", "vocab"]).error( - "Failed to parse {url}: {error}", - { error: e, url: url.href } - ); - return null; - } - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(e), - }); - throw e; } finally { span.end(); } + }, + ); + } + + protected static async __fromJsonLd__InteractionRule__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("https://gotosocial.org/ns#InteractionRule")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + const instance = new this( + { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + options, + ); + const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; + + let _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array = values["https://gotosocial.org/ns#automaticApproval"]; + + for ( + const v of _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array == null + ? [] + : _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array.length === 1 && "@list" in _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array[0] + ? _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array[0]["@list"] + : _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval__array + ) { + if (v == null) continue; + _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.push(v["@id"].startsWith("at://") + ? new URL("at://" + + encodeURIComponent( + v["@id"].includes("/", 5) + ? v["@id"].slice(5, v["@id"].indexOf("/", 5)) + : v["@id"].slice(5) + ) + + ( + v["@id"].includes("/", 5) + ? v["@id"].slice(v["@id"].indexOf("/", 5)) + : "" + ) + ) + : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + ? new URL(v["@id"]) + : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"])))) } + instance.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + const _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval: (URL)[] = []; - async #result_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL + let _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array = values["https://gotosocial.org/ns#manualApproval"]; + + for ( + const v of _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array == null + ? [] + : _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array.length === 1 && "@list" in _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array[0] + ? _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array[0]["@list"] + : _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval__array + ) { + if (v == null) continue; + _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.push(v["@id"].startsWith("at://") + ? new URL("at://" + + encodeURIComponent( + v["@id"].includes("/", 5) + ? v["@id"].slice(5, v["@id"].indexOf("/", 5)) + : v["@id"].slice(5) + ) + + ( + v["@id"].includes("/", 5) + ? v["@id"].slice(v["@id"].indexOf("/", 5)) + : "" + ) + ) + : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + ? new URL(v["@id"]) + : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"])))) + } + instance.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - const baseUrl = options.baseUrl; + } + return instance; + } + + protected _getCustomInspectProxy(): Record { + + const proxy: Record = {}; + if (this.id != null) { + proxy.id = { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(this.id!.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(this.id!.href, options), + }; + } - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider, baseUrl }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } + const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); + + if (_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length == 1) { + proxy.automaticApproval = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[0]; + } - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); - } - + if (_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length > 1 + || !("automaticApproval" in proxy) + && _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length > 0) { + proxy.automaticApprovals = _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + } + + const _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval + // deno-lint-ignore no-explicit-any + .map((v: any) => v instanceof URL + ? { + [Symbol.for("Deno.customInspect")]: ( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string => "URL " + inspect(v.href, options), + [Symbol.for("nodejs.util.inspect.custom")]: ( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string => "URL " + inspect(v.href, options), + } + : v); - /** - * Similar to - * {@link Activity.getResult}, - * but returns its \`@id\` URL instead of the object itself. - */ - get resultId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; - const v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - if (v instanceof URL) return v; - return v.id; + if (_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length == 1) { + proxy.manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[0]; } -/** Describes the result of the activity. For instance, if a particular action - * results in the creation of a new resource, the result property can be used - * to describe that new resource. + if (_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length > 1 + || !("manualApproval" in proxy) + && _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length > 0) { + proxy.manualApprovals = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + } + + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(InteractionRule.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: InteractionRule, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "InteractionRule " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(InteractionRule.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: InteractionRule, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "InteractionRule " + inspect(proxy, options); + }; + /** Proves that a {@link Like} interaction has been approved by the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that a like was authorized. The \`attributedTo\` property identifies + * the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ +export class LikeAuthorization extends Object { - async getResult( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < 1) return null; - let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) return null; - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "result" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "result"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#result_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' + /** + * The type URI of {@link LikeAuthorization}: \`https://gotosocial.org/ns#LikeApproval\`. + */ + static override get typeId(): URL { + return new URL("https://gotosocial.org/ns#LikeApproval"); + } + + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + /** + * Constructs a new instance of LikeAuthorization with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options); + if ("interactingObject" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + } else { + throw new TypeError( + "The interactingObject must be of type " + + "Object | URL" + ".", ); } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; } - return v; - } - /** - * Similar to - * {@link Activity.getResults}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get resultIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + if ("interactionTarget" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + } else { + throw new TypeError( + "The interactionTarget must be of type " + + "Object | URL" + ".", + ); + } } - return this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); } - -/** Describes the result of the activity. For instance, if a particular action - * results in the creation of a new resource, the result property can be used - * to describe that new resource. - * - */ - async* getResults( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "result" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "result"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#result_fromJsonLd(obj, options); - } + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): LikeAuthorization { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if ("interactingObject" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + } else { + throw new TypeError( + "The interactingObject must be of type " + + "Object | URL" + ".", + ); } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, + } + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if ("interactionTarget" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + } else { + throw new TypeError( + "The interactionTarget must be of type " + + "Object | URL" + ".", ); - continue; } - yield v; } - } - async #fetchOrigin( + return clone; + } + + async #fetchInteractingObject( url: URL, options: { documentLoader?: DocumentLoader, @@ -13932,7 +20421,7 @@ instruments?: (Object | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#origin_fromJsonLd( + const obj = await this.#interactingObject_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -13981,7 +20470,7 @@ instruments?: (Object | URL)[];} }); } - async #origin_fromJsonLd( + async #interactingObject_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -14014,30 +20503,28 @@ instruments?: (Object | URL)[];} /** * Similar to - * {@link Activity.getOrigin}, + * {@link LikeAuthorization.getInteractingObject}, * but returns its \`@id\` URL instead of the object itself. */ - get originId(): URL | null { + get interactingObjectId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; - const v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (v instanceof URL) return v; return v.id; } -/** Describes an indirect object of the activity from which the activity is - * directed. The precise meaning of the origin is the object of the English - * preposition "from". For instance, in the activity "John moved an item to - * List B from List A", the origin of the activity is "List A". +/** The URI of the interaction (e.g., a {@link Like} activity) that + * has been authorized. * */ - async getOrigin( + async getInteractingObject( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -14052,161 +20539,63 @@ instruments?: (Object | URL)[];} this._warning.values ); } - if (this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < 1) return null; - let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (options.crossOrigin !== "trust" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { v = v.id; } if (v instanceof URL) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) return null; - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(0); - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "origin" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "origin"]; - const doc = Array.isArray(prop) ? prop[0] : prop; - if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#origin_fromJsonLd(doc, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - return null; - } - return v; - } - - /** - * Similar to - * {@link Activity.getOrigins}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get originIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Describes an indirect object of the activity from which the activity is - * directed. The precise meaning of the origin is the object of the English - * preposition "from". For instance, in the activity "John moved an item to - * List B from List A", the origin of the activity is "List A". - * - */ - - async* getOrigins( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; } - const vs = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "origin" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "origin"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#origin_fromJsonLd(obj, options); - } + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "interactingObject" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "interactingObject"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); } + } - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' ); - continue; } - yield v; + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; } + return v; } - async #fetchInstrument( + async #fetchInteractionTarget( url: URL, options: { documentLoader?: DocumentLoader, @@ -14248,7 +20637,7 @@ instruments?: (Object | URL)[];} const { document, documentUrl } = fetchResult; const baseUrl = new URL(documentUrl); try { - const obj = await this.#instrument_fromJsonLd( + const obj = await this.#interactionTarget_fromJsonLd( document, { documentLoader, contextLoader, tracerProvider, baseUrl } ); @@ -14297,7 +20686,7 @@ instruments?: (Object | URL)[];} }); } - async #instrument_fromJsonLd( + async #interactionTarget_fromJsonLd( jsonLd: unknown, options: { documentLoader?: DocumentLoader, @@ -14330,28 +20719,27 @@ instruments?: (Object | URL)[];} /** * Similar to - * {@link Activity.getInstrument}, + * {@link LikeAuthorization.getInteractionTarget}, * but returns its \`@id\` URL instead of the object itself. */ - get instrumentId(): URL | null { + get interactionTargetId(): URL | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; - const v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (v instanceof URL) return v; return v.id; } -/** Identifies one or more objects used (or to be used) in the completion of - * an {@link Activity}. +/** The URI of the post that is the target of the authorized interaction. * */ - async getInstrument( + async getInteractionTarget( options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, @@ -14366,19 +20754,19 @@ instruments?: (Object | URL)[];} this._warning.values ); } - if (this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < 1) return null; - let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (options.crossOrigin !== "trust" && !(v instanceof URL) && v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { v = v.id; } if (v instanceof URL) { const fetched = - await this.#fetchInstrument(v, options); + await this.#fetchInteractionTarget(v, options); if (fetched == null) return null; - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(0); + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); this._cachedJsonLd = undefined; return fetched; } @@ -14387,19 +20775,19 @@ instruments?: (Object | URL)[];} this._cachedJsonLd != null && typeof this._cachedJsonLd === "object" && "@context" in this._cachedJsonLd && - "instrument" in this._cachedJsonLd + "interactionTarget" in this._cachedJsonLd ) { const prop = this._cachedJsonLd[ - "instrument"]; + "interactionTarget"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#instrument_fromJsonLd(doc, options); + v = await this.#interactionTarget_fromJsonLd(doc, options); } } if (options.crossOrigin !== "trust" && v?.id != null && this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -14422,102 +20810,6 @@ instruments?: (Object | URL)[];} return v; } - /** - * Similar to - * {@link Activity.getInstruments}, - * but returns their \`@id\`s instead of the objects themselves. - */ - get instrumentIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies one or more objects used (or to be used) in the completion of - * an {@link Activity}. - * - */ - - async* getInstruments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - crossOrigin?: "ignore" | "throw" | "trust"; - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; - for (let i = 0; i < vs.length; i++) { - let v = vs[i]; - if (options.crossOrigin !== "trust" && !(v instanceof URL) && - v.id != null && v.id.origin !== this.id?.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { - v = v.id; - } - if (v instanceof URL) { - const fetched = - await this.#fetchInstrument(v, options); - if (fetched == null) continue; - vs[i] = fetched; - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "instrument" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "instrument"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#instrument_fromJsonLd(obj, options); - } - } - - if (options.crossOrigin !== "trust" && v?.id != null && - this.id != null && v.id.origin !== this.id.origin && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { - if (options.crossOrigin === "throw") { - throw new Error( - "The property object's @id (" + v.id.href + ") has a different " + - "origin than the property owner's @id (" + this.id.href + "); " + - "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".' - ); - } - getLogger(["fedify", "vocab"]).warn( - "The property object's @id ({objectId}) has a different origin " + - "than the property owner's @id ({parentObjectId}); 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".', - { objectId: v.id.href, parentObjectId: this.id.href }, - ); - continue; - } - yield v; - } - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -14547,6 +20839,63 @@ instruments?: (Object | URL)[];} contextLoader: options.contextLoader ?? getDocumentLoader(), }; + if (options.format == null && this.isCompactable()) { + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + + // deno-lint-ignore no-unused-vars + let compactItems: unknown[]; + + compactItems = []; + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["interactingObject"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + compactItems = []; + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + const item = ( + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) + ); + compactItems.push(item); + } + if (compactItems.length > 0) { + + result["interactionTarget"] + = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + } + + result["type"] = "LikeAuthorization"; + if (this.id != null) result["id"] = this.id.href; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; + return result; + } + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; @@ -14561,67 +20910,7 @@ instruments?: (Object | URL)[];} >; array = []; - for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#actor"] = propValue; - - } - - array = []; - for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#object"] = propValue; - - } - - array = []; - for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#target"] = propValue; - - } - - array = []; - for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; - } - if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#result"] = propValue; - - } - - array = []; - for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const element = ( v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) ); @@ -14631,12 +20920,12 @@ instruments?: (Object | URL)[];} const propValue = ( array ); - values["https://www.w3.org/ns/activitystreams#origin"] = propValue; + values["https://gotosocial.org/ns#interactingObject"] = propValue; } array = []; - for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const element = ( v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) ); @@ -14646,11 +20935,11 @@ instruments?: (Object | URL)[];} const propValue = ( array ); - values["https://www.w3.org/ns/activitystreams#instrument"] = propValue; + values["https://gotosocial.org/ns#interactionTarget"] = propValue; } - values["@type"] = ["https://www.w3.org/ns/activitystreams#Activity"]; + values["@type"] = ["https://gotosocial.org/ns#LikeApproval"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { return await jsonld.expand( @@ -14659,7 +20948,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -14692,214 +20981,94 @@ instruments?: (Object | URL)[];} * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. * @param options The options to use. - * - \`documentLoader\`: The loader for remote JSON-LD documents. - * - \`contextLoader\`: The loader for remote JSON-LD contexts. - * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. - * If omitted, the global tracer provider is used. - * @returns The object of this type. - * @throws {TypeError} If the given \`json\` is invalid. - */ - static override async fromJsonLd( - json: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL, - } = {}, - ): Promise { - const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/vocab-tools", - "0.0.0", - ); - return await tracer.startActiveSpan( - "activitypub.parse_object", - async (span) => { - try { - const object = await this.__fromJsonLd__Activity__( - json, span, options); - if (object.id != null) { - span.setAttribute("activitypub.object.id", object.id.href); - } - return object; - } catch (error) { - span.setStatus({ - code: SpanStatusCode.ERROR, - message: String(error), - }); - throw error; - } finally { - span.end(); - } - }, - ); - } - - protected static async __fromJsonLd__Activity__( - json: unknown, - span: Span, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - baseUrl?: URL, - } = {}, - ): Promise { - if (typeof json === "undefined") { - throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); - options = { - ...options, - documentLoader: options.documentLoader ?? getDocumentLoader(), - contextLoader: options.contextLoader ?? getDocumentLoader(), - tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), - }; - // deno-lint-ignore no-explicit-any - let values: Record & { "@id"?: string }; - if (globalThis.Object.keys(json).length == 0) { - values = {}; - } else { - const expanded = await jsonld.expand(json, { - documentLoader: options.contextLoader, - keepFreeFloatingNodes: true, - }); - values = - // deno-lint-ignore no-explicit-any - (expanded[0] ?? {}) as (Record & { "@id"?: string }); - } - if (options.baseUrl == null && values["@id"] != null) { - options = { ...options, baseUrl: new URL(values["@id"]) }; - } - - if ("@type" in values) { - span.setAttribute("activitypub.object.type", values["@type"]); - } - if ("@type" in values && - !values["@type"].every(t => t.startsWith("_:"))) { - - if (values["@type"].includes("http://litepub.social/ns#EmojiReact")) { - return await EmojiReact.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) { - return await Accept.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeAccept")) { - return await TentativeAccept.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Add")) { - return await Add.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Announce")) { - return await Announce.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Create")) { - return await Create.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Delete")) { - return await Delete.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Dislike")) { - return await Dislike.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Flag")) { - return await Flag.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Follow")) { - return await Follow.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Ignore")) { - return await Ignore.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Block")) { - return await Block.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#IntransitiveActivity")) { - return await IntransitiveActivity.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Arrive")) { - return await Arrive.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Question")) { - return await Question.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Travel")) { - return await Travel.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Join")) { - return await Join.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Leave")) { - return await Leave.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Like")) { - return await Like.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Listen")) { - return await Listen.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Move")) { - return await Move.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Offer")) { - return await Offer.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Invite")) { - return await Invite.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Read")) { - return await Read.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Reject")) { - return await Reject.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#TentativeReject")) { - return await TentativeReject.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Remove")) { - return await Remove.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Undo")) { - return await Undo.fromJsonLd(json, options); + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__LikeAuthorization__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__LikeAuthorization__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Update")) { - return await Update.fromJsonLd(json, options); + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#View")) { - return await View.fromJsonLd(json, options); + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; } - - if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) { + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("https://gotosocial.org/ns#LikeApproval")) { throw new TypeError("Invalid type: " + values["@type"]); } } @@ -14910,212 +21079,69 @@ instruments?: (Object | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof Activity)) { + if (!(instance instanceof LikeAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); - - let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values["https://www.w3.org/ns/activitystreams#actor"]; - - for ( - const v of _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array == null - ? [] - : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array.length === 1 && "@list" in _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0] - ? _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array[0]["@list"] - : _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array - ) { - if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { - _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push( - !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") - ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) - ); - continue; - } - - const decoded = - typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - ) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - ) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - ) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - ) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - ) : undefined - ; - if (typeof decoded === "undefined") continue; - _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); - - } - instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - - const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); - - let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values["https://www.w3.org/ns/activitystreams#object"]; - - for ( - const v of _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array == null - ? [] - : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array.length === 1 && "@list" in _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0] - ? _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array[0]["@list"] - : _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array - ) { - if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( - !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") - ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) - ); - continue; - } - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - )) - } - instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - - const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); - - let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values["https://www.w3.org/ns/activitystreams#target"]; - - for ( - const v of _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array == null - ? [] - : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array.length === 1 && "@list" in _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0] - ? _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array[0]["@list"] - : _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array - ) { - if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( - !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") - ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) - ); - continue; - } - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - )) - } - instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - - const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); - - let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values["https://www.w3.org/ns/activitystreams#result"]; - - for ( - const v of _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array == null - ? [] - : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array.length === 1 && "@list" in _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0] - ? _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array[0]["@list"] - : _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array - ) { - if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( - !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") - ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) - ); - continue; - } - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( - v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } - )) - } - instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - - const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); - let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values["https://www.w3.org/ns/activitystreams#origin"]; + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; for ( - const v of _25zu2s3VxVujgEKqrDycjE284XQR_origin__array == null + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] - : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array.length === 1 && "@list" in _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0] - ? _25zu2s3VxVujgEKqrDycjE284XQR_origin__array[0]["@list"] - : _25zu2s3VxVujgEKqrDycjE284XQR_origin__array + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array ) { if (v == null) continue; if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) { - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) : new URL(v["@id"]) ); continue; } - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } )) } - instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; - const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); - let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values["https://www.w3.org/ns/activitystreams#instrument"]; + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; for ( - const v of _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array == null + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] - : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array.length === 1 && "@list" in _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0] - ? _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array[0]["@list"] - : _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array ) { if (v == null) continue; if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) { - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) : new URL(v["@id"]) ); continue; } - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } )) } - instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; if (!("_fromSubclass" in options) || !options._fromSubclass) { try { @@ -15132,111 +21158,7 @@ instruments?: (Object | URL)[];} protected override _getCustomInspectProxy(): Record { const proxy: Record = super._getCustomInspectProxy(); - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length == 1) { - proxy.actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; - } - - if (_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 1 - || !("actor" in proxy) - && _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length > 0) { - proxy.actors = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; - } - - const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length == 1) { - proxy.object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; - } - - if (_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 1 - || !("object" in proxy) - && _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length > 0) { - proxy.objects = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; - } - - const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length == 1) { - proxy.target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; - } - - if (_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 1 - || !("target" in proxy) - && _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length > 0) { - proxy.targets = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; - } - - const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL - ? { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(v.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(v.href, options), - } - : v); - - if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length == 1) { - proxy.result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; - } - - if (_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 1 - || !("result" in proxy) - && _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length > 0) { - proxy.results = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; - } - - const _25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -15252,17 +21174,11 @@ instruments?: (Object | URL)[];} } : v); - if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length == 1) { - proxy.origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; - } - - if (_25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 1 - || !("origin" in proxy) - && _25zu2s3VxVujgEKqrDycjE284XQR_origin.length > 0) { - proxy.origins = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; } - const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -15278,14 +21194,8 @@ instruments?: (Object | URL)[];} } : v); - if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length == 1) { - proxy.instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; - } - - if (_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 1 - || !("instrument" in proxy) - && _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length > 0) { - proxy.instruments = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; } return proxy; @@ -15294,41 +21204,50 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any -(Activity.prototype as any)[Symbol.for("Deno.customInspect")] = +(LikeAuthorization.prototype as any)[Symbol.for("Deno.customInspect")] = function ( - this: Activity, + this: LikeAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return "Activity " + inspect(proxy, options); + return "LikeAuthorization " + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(Activity.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = +(LikeAuthorization.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = function ( - this: Activity, + this: LikeAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return "Activity " + inspect(proxy, options); + return "LikeAuthorization " + inspect(proxy, options); }; - /** Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0). + /** A request to like a post that requires approval from the post author. + * + * The \`object\` property references the post to be liked, and + * the \`instrument\` property contains the {@link Like} activity itself. + * + * The post author responds with an {@link Accept} (with a + * {@link LikeAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. * */ -export class EmojiReact extends Activity { +export class LikeRequest extends Activity { /** - * The type URI of {@link EmojiReact}: \`http://litepub.social/ns#EmojiReact\`. + * The type URI of {@link LikeRequest}: \`https://gotosocial.org/ns#LikeRequest\`. */ static override get typeId(): URL { - return new URL("http://litepub.social/ns#EmojiReact"); + return new URL("https://gotosocial.org/ns#LikeRequest"); } /** - * Constructs a new instance of EmojiReact with the given values. + * Constructs a new instance of LikeRequest with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -15352,7 +21271,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -15394,7 +21313,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -15407,7 +21326,7 @@ instruments?: (Object | URL)[];} documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): EmojiReact { + ): LikeRequest { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -15416,7 +21335,7 @@ instruments?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as EmojiReact; + const clone = super.clone(values, options) as unknown as LikeRequest; return clone; } @@ -15462,7 +21381,7 @@ instruments?: (Object | URL)[];} unknown[] | { "@list": unknown[] } | string >; - values["@type"] = ["http://litepub.social/ns#EmojiReact"]; + values["@type"] = ["https://gotosocial.org/ns#LikeRequest"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { return await jsonld.expand( @@ -15471,7 +21390,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"litepub":"http://litepub.social/ns#","toot":"http://joinmastodon.org/ns#","EmojiReact":"litepub:EmojiReact","Emoji":"toot:Emoji"}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -15519,7 +21438,7 @@ instruments?: (Object | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( "@fedify/vocab-tools", @@ -15529,7 +21448,7 @@ instruments?: (Object | URL)[];} "activitypub.parse_object", async (span) => { try { - const object = await this.__fromJsonLd__EmojiReact__( + const object = await this.__fromJsonLd__LikeRequest__( json, span, options); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); @@ -15548,7 +21467,7 @@ instruments?: (Object | URL)[];} ); } - protected static async __fromJsonLd__EmojiReact__( + protected static async __fromJsonLd__LikeRequest__( json: unknown, span: Span, options: { @@ -15557,7 +21476,7 @@ instruments?: (Object | URL)[];} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); } @@ -15591,7 +21510,7 @@ instruments?: (Object | URL)[];} if ("@type" in values && !values["@type"].every(t => t.startsWith("_:"))) { - if (!values["@type"].includes("http://litepub.social/ns#EmojiReact")) { + if (!values["@type"].includes("https://gotosocial.org/ns#LikeRequest")) { throw new TypeError("Invalid type: " + values["@type"]); } } @@ -15602,7 +21521,7 @@ instruments?: (Object | URL)[];} // @ts-ignore: an internal option _fromSubclass: true, }); - if (!(instance instanceof EmojiReact)) { + if (!(instance instanceof LikeRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } @@ -15627,81 +21546,54 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any -(EmojiReact.prototype as any)[Symbol.for("Deno.customInspect")] = +(LikeRequest.prototype as any)[Symbol.for("Deno.customInspect")] = function ( - this: EmojiReact, + this: LikeRequest, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return "EmojiReact " + inspect(proxy, options); + return "LikeRequest " + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(EmojiReact.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = +(LikeRequest.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = function ( - this: EmojiReact, + this: LikeRequest, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return "EmojiReact " + inspect(proxy, options); + return "LikeRequest " + inspect(proxy, options); }; - /** A pair of property name and value. + /** Proves that a reply interaction has been approved by the post author. + * + * This object is dereferenceable and is used by third parties to verify + * that a reply was authorized. The \`attributedTo\` property identifies + * the post author who granted the approval. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * */ -export class PropertyValue { - - readonly #documentLoader?: DocumentLoader; - readonly #contextLoader?: DocumentLoader; - readonly #tracerProvider?: TracerProvider; - readonly #warning?: { - category: string[]; - message: string; - values?: Record; - }; - #cachedJsonLd?: unknown; - readonly id: URL | null; - - protected get _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } - - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } - - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } - - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } - - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } +export class ReplyAuthorization extends Object { - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - /** - * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. + * The type URI of {@link ReplyAuthorization}: \`https://gotosocial.org/ns#ReplyAuthorization\`. */ - static get typeId(): URL { - return new URL("http://schema.org#PropertyValue"); + static override get typeId(): URL { + return new URL("https://gotosocial.org/ns#ReplyAuthorization"); } - #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; -#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; - + + #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + /** - * Constructs a new instance of PropertyValue with the given values. + * Constructs a new instance of ReplyAuthorization with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ @@ -15709,7 +21601,23 @@ export class PropertyValue { values: { id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -15717,45 +21625,29 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, } = {}, ) { - - this.#documentLoader = options.documentLoader; - this.#contextLoader = options.contextLoader; - this.#tracerProvider = options.tracerProvider; - if ("$warning" in options) { - this.#warning = options.$warning as unknown as { - category: string[]; - message: string; - values?: Record; - }; - } - if (values.id == null || values.id instanceof URL) { - this.id = values.id ?? null; - } else { - throw new TypeError("The id must be a URL."); - } - - if ("name" in values && values.name != null) { - if (typeof values.name === "string" || values.name instanceof LanguageString) { + super(values, options); + if ("interactingObject" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; - + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); } else { throw new TypeError( - "The name must be of type " + - "string | LanguageString" + ".", + "The interactingObject must be of type " + + "Object | URL" + ".", ); } } - if ("value" in values && values.value != null) { - if (typeof values.value === "string" || values.value instanceof LanguageString) { + if ("interactionTarget" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; - + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); } else { throw new TypeError( - "The value must be of type " + - "string | LanguageString" + ".", + "The interactionTarget must be of type " + + "Object | URL" + ".", ); } } @@ -15767,18 +21659,34 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @param options The options to use for cloning. * @returns The cloned instance. */ - clone( + override clone( values: { id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, } = {} - ): PropertyValue { + ): ReplyAuthorization { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, @@ -15787,35 +21695,29 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - - // @ts-ignore: this.constructor is not recognized as a constructor, but it is. - const clone: PropertyValue = new this.constructor( - { id: values.id ?? this.id }, - options - ); - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - if ("name" in values && values.name != null) { - if (typeof values.name === "string" || values.name instanceof LanguageString) { + const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject;clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + if ("interactingObject" in values && values.interactingObject != null) { + if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = [values.name]; - + clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); } else { throw new TypeError( - "The name must be of type " + - "string | LanguageString" + ".", + "The interactingObject must be of type " + + "Object | URL" + ".", ); } } - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - if ("value" in values && values.value != null) { - if (typeof values.value === "string" || values.value instanceof LanguageString) { + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget;clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + if ("interactionTarget" in values && values.interactionTarget != null) { + if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = [values.value]; - + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); } else { throw new TypeError( - "The value must be of type " + - "string | LanguageString" + ".", + "The interactionTarget must be of type " + + "Object | URL" + ".", ); } } @@ -15823,30 +21725,435 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return clone; } -/** The name of a property. + async #fetchInteractingObject( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactingObject_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactingObject_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link ReplyAuthorization.getInteractingObject}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactingObjectId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + const v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the reply object (e.g., a {@link Note}) that has been + * authorized. + * */ - get name(): (string | LanguageString | null) { + + async getInteractingObject( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < 1) return null; - return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + if (this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < 1) return null; + let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractingObject(v, options); + if (fetched == null) return null; + this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0] = fetched; + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "interactingObject" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "interactingObject"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#interactingObject_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } -/** The value of a property. + async #fetchInteractionTarget( + url: URL, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {}, + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + let fetchResult: RemoteDocument; + try { + fetchResult = await documentLoader(url.href); + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + span.end(); + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to fetch {url}: {error}", + { error, url: url.href } + ); + return null; + } + throw error; + } + const { document, documentUrl } = fetchResult; + const baseUrl = new URL(documentUrl); + try { + const obj = await this.#interactionTarget_fromJsonLd( + document, + { documentLoader, contextLoader, tracerProvider, baseUrl } + ); + if (options.crossOrigin !== "trust" && obj?.id != null && + obj.id.origin !== baseUrl.origin) { + if (options.crossOrigin === "throw") { + throw new Error( + "The object's @id (" + obj.id.href + ") has a different origin " + + "than the document URL (" + baseUrl.href + "); 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".' + ); + } + getLogger(["fedify", "vocab"]).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".', + { ...fetchResult, objectId: obj.id.href }, + ); + return null; + } + span.setAttribute("activitypub.object.id", (obj.id ?? url).href); + span.setAttribute( + "activitypub.object.type", + // @ts-ignore: obj.constructor always has a typeId. + obj.constructor.typeId.href + ); + return obj; + } catch (e) { + if (options.suppressError) { + getLogger(["fedify", "vocab"]).error( + "Failed to parse {url}: {error}", + { error: e, url: url.href } + ); + return null; + } + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(e), + }); + throw e; + } finally { + span.end(); + } + }); + } + + async #interactionTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL + } + ): Promise { + const documentLoader = + options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); + const contextLoader = + options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + const baseUrl = options.baseUrl; + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider, baseUrl }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError("Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", ")); + } + + + /** + * Similar to + * {@link ReplyAuthorization.getInteractionTarget}, + * but returns its \`@id\` URL instead of the object itself. + */ + get interactionTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + } + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + const v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (v instanceof URL) return v; + return v.id; + } + +/** The URI of the post that is the target of the authorized reply. + * */ - get value(): (string | LanguageString | null) { + + async getInteractionTarget( + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + suppressError?: boolean, + tracerProvider?: TracerProvider, + crossOrigin?: "ignore" | "throw" | "trust"; + } = {} + ): Promise { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, this._warning.values ); } - if (this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < 1) return null; - return this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + if (this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < 1) return null; + let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; + if (options.crossOrigin !== "trust" && !(v instanceof URL) && + v.id != null && v.id.origin !== this.id?.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + v = v.id; + } + if (v instanceof URL) { + const fetched = + await this.#fetchInteractionTarget(v, options); + if (fetched == null) return null; + this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0] = fetched; + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.add(0); + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "interactionTarget" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "interactionTarget"]; + const doc = Array.isArray(prop) ? prop[0] : prop; + if (doc != null && typeof doc === "object" && "@context" in doc) { + v = await this.#interactionTarget_fromJsonLd(doc, options); + } + } + + if (options.crossOrigin !== "trust" && v?.id != null && + this.id != null && v.id.origin !== this.id.origin && + !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + if (options.crossOrigin === "throw") { + throw new Error( + "The property object's @id (" + v.id.href + ") has a different " + + "origin than the property owner's @id (" + this.id.href + "); " + + "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".' + ); + } + getLogger(["fedify", "vocab"]).warn( + "The property object's @id ({objectId}) has a different origin " + + "than the property owner's @id ({parentObjectId}); 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".', + { objectId: v.id.href, parentObjectId: this.id.href }, + ); + return null; + } + return v; } /** @@ -15859,7 +22166,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} when \`format\` is set to \`'expand'\`. * @returns The JSON-LD representation of this object. */ - async toJsonLd(options: { + override async toJsonLd(options: { format?: "compact" | "expand", contextLoader?: DocumentLoader, context?: string | Record | (string | Record)[], @@ -15879,23 +22186,30 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} }; if (options.format == null && this.isCompactable()) { - const result: Record = {}; + + const result = await super.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) as Record; + // deno-lint-ignore no-unused-vars let compactItems: unknown[]; compactItems = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.locale.baseName, - } + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) ); compactItems.push(item); } if (compactItems.length > 0) { - result["name"] + result["interactingObject"] = compactItems.length > 1 ? compactItems : compactItems[0]; @@ -15903,40 +22217,48 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } compactItems = []; - for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.locale.baseName, - } + v instanceof URL ? v.href : await v.toJsonLd({ + ...(options), + format: undefined, + context: undefined, + }) ); compactItems.push(item); } if (compactItems.length > 0) { - result["value"] + result["interactionTarget"] = compactItems.length > 1 ? compactItems : compactItems[0]; } - result["type"] = "PropertyValue"; + result["type"] = "ReplyAuthorization"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams",{"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + + const baseValues = await super.toJsonLd({ + ...options, + format: "expand", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { "@list": unknown[] } | string + >; + array = []; - for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { const element = ( - typeof v === "string" ? { "@value": v } : { - "@value": v.toString(), - "@language": v.locale.baseName, - } + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) ); array.push(element);; } @@ -15944,17 +22266,14 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const propValue = ( array ); - values["https://www.w3.org/ns/activitystreams#name"] = propValue; + values["https://gotosocial.org/ns#interactingObject"] = propValue; } array = []; - for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { const element = ( - typeof v === "string" ? { "@value": v } : { - "@value": v.toString(), - "@language": v.locale.baseName, - } + v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) ); array.push(element);; } @@ -15962,11 +22281,11 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const propValue = ( array ); - values["http://schema.org#value"] = propValue; + values["https://gotosocial.org/ns#interactionTarget"] = propValue; } - values["@type"] = ["http://schema.org#PropertyValue"]; + values["@type"] = ["https://gotosocial.org/ns#ReplyAuthorization"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { return await jsonld.expand( @@ -15975,7 +22294,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams",{"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -15984,23 +22303,24 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} if (docContext != null) { // Embed context + if ("proof" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element["@context"] = docContext; + } + } else { + compacted.proof["@context"] = docContext; + } + } + } return compacted; } - protected isCompactable(): boolean { + protected override isCompactable(): boolean { - if ( - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 - ) return false; - - if ( - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value != null && - this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length > 0 - ) return false; - - return true; + return super.isCompactable(); } /** @@ -16014,7 +22334,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @returns The object of this type. * @throws {TypeError} If the given \`json\` is invalid. */ - static async fromJsonLd( + static override async fromJsonLd( json: unknown, options: { documentLoader?: DocumentLoader, @@ -16022,7 +22342,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); const tracer = tracerProvider.getTracer( "@fedify/vocab-tools", @@ -16032,7 +22352,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} "activitypub.parse_object", async (span) => { try { - const object = await this.__fromJsonLd__PropertyValue__( + const object = await this.__fromJsonLd__ReplyAuthorization__( json, span, options); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); @@ -16051,7 +22371,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } - protected static async __fromJsonLd__PropertyValue__( + protected static async __fromJsonLd__ReplyAuthorization__( json: unknown, span: Span, options: { @@ -16060,7 +22380,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} tracerProvider?: TracerProvider, baseUrl?: URL, } = {}, - ): Promise { + ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); } @@ -16094,63 +22414,80 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} if ("@type" in values && !values["@type"].every(t => t.startsWith("_:"))) { - if (!values["@type"].includes("http://schema.org#PropertyValue")) { + if (!values["@type"].includes("https://gotosocial.org/ns#ReplyAuthorization")) { throw new TypeError("Invalid type: " + values["@type"]); } } - const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, - options, - ); - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; - - let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values["https://www.w3.org/ns/activitystreams#name"]; + delete values["@type"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ReplyAuthorization)) { + throw new TypeError("Unexpected type: " + instance.constructor.name); + } + + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + + let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; for ( - const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null + const v of _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array == null ? [] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && "@list" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] - ? _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0]["@list"] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array.length === 1 && "@list" in _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0] + ? _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array[0]["@list"] + : _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array ) { if (v == null) continue; - const decoded = - typeof v === "object" && "@value" in v - && typeof v["@value"] === "string" && !("@language" in v) ? v["@value"] : typeof v === "object" && "@language" in v && "@value" in v - && typeof v["@language"] === "string" - && typeof v["@value"] === "string" ? new LanguageString(v["@value"], v["@language"]) : undefined - ; - if (typeof decoded === "undefined") continue; - _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.push(decoded); - + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) } - instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; - - let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values["http://schema.org#value"]; + instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + + let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; for ( - const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null + const v of _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array == null ? [] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && "@list" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] - ? _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0]["@list"] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array.length === 1 && "@list" in _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0] + ? _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array[0]["@list"] + : _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array ) { if (v == null) continue; - const decoded = - typeof v === "object" && "@value" in v - && typeof v["@value"] === "string" && !("@language" in v) ? v["@value"] : typeof v === "object" && "@language" in v && "@value" in v - && typeof v["@language"] === "string" - && typeof v["@value"] === "string" ? new LanguageString(v["@value"], v["@language"]) : undefined - ; - if (typeof decoded === "undefined") continue; - _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.push(decoded); - + if (typeof v === "object" && "@id" in v && !("@type" in v) + && globalThis.Object.keys(v).length === 1) { + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push( + !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") + ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) + : new URL(v["@id"]) + ); + continue; + } + _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(await Object.fromJsonLd( + v, + { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + )) } - instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; if (!("_fromSubclass" in options) || !options._fromSubclass) { try { @@ -16165,24 +22502,9 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return instance; } - protected _getCustomInspectProxy(): Record { - - const proxy: Record = {}; - if (this.id != null) { - proxy.id = { - [Symbol.for("Deno.customInspect")]: ( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string => "URL " + inspect(this.id!.href, options), - [Symbol.for("nodejs.util.inspect.custom")]: ( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string => "URL " + inspect(this.id!.href, options), - }; - } - - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -16198,11 +22520,11 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } : v); - if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { - proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + if (_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length == 1) { + proxy.interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; } - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value + const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget // deno-lint-ignore no-explicit-any .map((v: any) => v instanceof URL ? { @@ -16218,8 +22540,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } : v); - if (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { - proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + if (_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length == 1) { + proxy.interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; } return proxy; @@ -16228,26 +22550,368 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any -(PropertyValue.prototype as any)[Symbol.for("Deno.customInspect")] = +(ReplyAuthorization.prototype as any)[Symbol.for("Deno.customInspect")] = function ( - this: PropertyValue, + this: ReplyAuthorization, inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { const proxy = this._getCustomInspectProxy(); - return "PropertyValue " + inspect(proxy, options); + return "ReplyAuthorization " + inspect(proxy, options); }; // deno-lint-ignore no-explicit-any -(PropertyValue.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = +(ReplyAuthorization.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = function ( - this: PropertyValue, + this: ReplyAuthorization, _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, ): string { const proxy = this._getCustomInspectProxy(); - return "PropertyValue " + inspect(proxy, options); + return "ReplyAuthorization " + inspect(proxy, options); + }; + /** A request to reply to a post that requires approval from the post author. + * + * The \`object\` property references the post to be replied to, and + * the \`instrument\` property contains the reply itself (e.g., a {@link Note}). + * + * The post author responds with an {@link Accept} (with a + * {@link ReplyAuthorization} as \`result\`) or a {@link Reject}. + * + * See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + * for details. + * + */ +export class ReplyRequest extends Activity { + + /** + * The type URI of {@link ReplyRequest}: \`https://gotosocial.org/ns#ReplyRequest\`. + */ + static override get typeId(): URL { + return new URL("https://gotosocial.org/ns#ReplyRequest"); + } + + /** + * Constructs a new instance of ReplyRequest with the given values. + * @param values The values to initialize the instance with. + * @param options The options to use for initialization. + */ + constructor( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + } = {} + ): ReplyRequest { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as ReplyRequest; + return clone; + } + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * - \`format\`: The format of the output: \`compact\` or + \`expand\`. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`context\`: The JSON-LD context to use. Not applicable + when \`format\` is set to \`'expand'\`. + * @returns The JSON-LD representation of this object. + */ + override async toJsonLd(options: { + format?: "compact" | "expand", + contextLoader?: DocumentLoader, + context?: string | Record | (string | Record)[], + } = {}): Promise { + if (options.format == null && this._cachedJsonLd != null) { + return this._cachedJsonLd; + } + if (options.format !== "compact" && options.context != null) { + throw new TypeError( + "The context option can only be used when the format option is set " + + "to 'compact'." + ); + } + options = { + ...options, + contextLoader: options.contextLoader ?? getDocumentLoader(), + }; + + // deno-lint-ignore no-unused-vars prefer-const + let array: unknown[]; + + const baseValues = await super.toJsonLd({ + ...options, + format: "expand", + context: undefined, + }) as unknown[]; + const values = baseValues[0] as Record< + string, + unknown[] | { "@list": unknown[] } | string + >; + + values["@type"] = ["https://gotosocial.org/ns#ReplyRequest"]; + if (this.id != null) values["@id"] = this.id.href; + if (options.format === "expand") { + return await jsonld.expand( + values, + { documentLoader: options.contextLoader }, + ); + } + const docContext = options.context ?? + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; + const compacted = await jsonld.compact( + values, + docContext, + { documentLoader: options.contextLoader }, + ); + if (docContext != null) { + // Embed context + + if ("proof" in compacted && + compacted.proof != null) { + if (Array.isArray(compacted.proof)) { + for (const element of compacted.proof) { + element["@context"] = docContext; + } + } else { + compacted.proof["@context"] = docContext; + } + } + + } + return compacted; + } + + protected override isCompactable(): boolean { + + return super.isCompactable(); + } + + /** + * Converts a JSON-LD structure to an object of this type. + * @param json The JSON-LD structure to convert. + * @param options The options to use. + * - \`documentLoader\`: The loader for remote JSON-LD documents. + * - \`contextLoader\`: The loader for remote JSON-LD contexts. + * - \`tracerProvider\`: The OpenTelemetry tracer provider to use. + * If omitted, the global tracer provider is used. + * @returns The object of this type. + * @throws {TypeError} If the given \`json\` is invalid. + */ + static override async fromJsonLd( + json: unknown, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/vocab-tools", + "0.0.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__ReplyRequest__( + json, span, options); + if (object.id != null) { + span.setAttribute("activitypub.object.id", object.id.href); + } + return object; + } catch (error) { + span.setStatus({ + code: SpanStatusCode.ERROR, + message: String(error), + }); + throw error; + } finally { + span.end(); + } + }, + ); + } + + protected static async __fromJsonLd__ReplyRequest__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + baseUrl?: URL, + } = {}, + ): Promise { + if (typeof json === "undefined") { + throw new TypeError("Invalid JSON-LD: undefined."); + } + else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + options = { + ...options, + documentLoader: options.documentLoader ?? getDocumentLoader(), + contextLoader: options.contextLoader ?? getDocumentLoader(), + tracerProvider: options.tracerProvider ?? trace.getTracerProvider(), + }; + // deno-lint-ignore no-explicit-any + let values: Record & { "@id"?: string }; + if (globalThis.Object.keys(json).length == 0) { + values = {}; + } else { + const expanded = await jsonld.expand(json, { + documentLoader: options.contextLoader, + keepFreeFloatingNodes: true, + }); + values = + // deno-lint-ignore no-explicit-any + (expanded[0] ?? {}) as (Record & { "@id"?: string }); + } + if (options.baseUrl == null && values["@id"] != null) { + options = { ...options, baseUrl: new URL(values["@id"]) }; + } + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); + } + if ("@type" in values && + !values["@type"].every(t => t.startsWith("_:"))) { + + if (!values["@type"].includes("https://gotosocial.org/ns#ReplyRequest")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + + delete values["@type"]; + const instance = await super.fromJsonLd(values, { + ...options, + // @ts-ignore: an internal option + _fromSubclass: true, + }); + if (!(instance instanceof ReplyRequest)) { + throw new TypeError("Unexpected type: " + instance.constructor.name); + } + + if (!("_fromSubclass" in options) || !options._fromSubclass) { + try { + instance._cachedJsonLd = structuredClone(json); + } catch { + getLogger(["fedify", "vocab"]).warn( + "Failed to cache JSON-LD: {json}", + { json }, + ); + } + } + return instance; + } + + protected override _getCustomInspectProxy(): Record { + const proxy: Record = super._getCustomInspectProxy(); + return proxy; + } + } + + +// deno-lint-ignore no-explicit-any +(ReplyRequest.prototype as any)[Symbol.for("Deno.customInspect")] = + function ( + this: ReplyRequest, + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "ReplyRequest " + inspect(proxy, options); + }; + +// deno-lint-ignore no-explicit-any +(ReplyRequest.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] = + function ( + this: ReplyRequest, + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "ReplyRequest " + inspect(proxy, options); }; /** Means of communicating or interacting with the DID subject or associated * entities via one or more service endpoints. Examples include discovery @@ -19844,7 +26508,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -19886,7 +26550,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -19963,7 +26627,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -20184,7 +26848,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20226,7 +26890,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20303,7 +26967,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -20519,7 +27183,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20561,7 +27225,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -20638,7 +27302,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -20899,7 +27563,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -21363,7 +28027,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -25782,7 +32446,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result["type"] = "Application"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; return result; } @@ -26141,7 +32805,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; const compacted = await jsonld.compact( values, docContext, @@ -27444,7 +34108,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27486,7 +34150,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27563,7 +34227,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -27791,7 +34455,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27833,7 +34497,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -27910,7 +34574,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -28124,7 +34788,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} , options: { documentLoader?: DocumentLoader, @@ -28173,7 +34837,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} = {}, options: { @@ -28297,7 +34961,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} result["type"] = "Article"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -28342,7 +35006,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -28600,7 +35264,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -28662,7 +35326,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -28812,7 +35476,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result["type"] = "Document"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -28874,7 +35538,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -29173,7 +35837,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -29209,7 +35873,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -29271,7 +35935,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result["type"] = "Audio"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -29297,7 +35961,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -29512,7 +36176,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29554,7 +36218,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29631,7 +36295,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -29852,7 +36516,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29894,7 +36558,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -29971,7 +36635,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -30226,7 +36890,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -30437,7 +37101,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} = {}, options: { @@ -33546,7 +40210,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result["type"] = "Collection"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -33770,7 +40434,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -34048,7 +40712,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -34657,7 +41321,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -34732,7 +41396,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} = {}, options: { @@ -35538,7 +42202,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result["type"] = "CollectionPage"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -35609,7 +42273,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -35976,7 +42640,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36018,7 +42682,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36095,7 +42759,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -36310,7 +42974,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36352,7 +43016,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36429,7 +43093,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri"}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","ChatMessage":"http://litepub.social/ns#ChatMessage","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri"}]; const compacted = await jsonld.compact( values, docContext, @@ -36642,7 +43306,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36684,7 +43348,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -36761,7 +43425,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; const compacted = await jsonld.compact( values, docContext, @@ -38078,7 +44742,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -38114,7 +44778,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;} = {}, options: { @@ -38176,7 +44840,7 @@ proofs?: (DataIntegrityProof | URL)[];} result["type"] = "Event"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -38202,7 +44866,7 @@ proofs?: (DataIntegrityProof | URL)[];} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -38418,7 +45082,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38460,7 +45124,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38537,7 +45201,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -38754,7 +45418,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38796,7 +45460,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -38873,7 +45537,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -39134,7 +45798,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -39598,7 +46262,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -44017,7 +50681,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result["type"] = "Group"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; return result; } @@ -44376,7 +51040,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; const compacted = await jsonld.compact( values, docContext, @@ -47062,7 +53726,7 @@ get names(): ((string | LanguageString))[] { v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } ) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -47642,7 +54306,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -47678,7 +54342,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -47740,7 +54404,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result["type"] = "Image"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = "https://www.w3.org/ns/activitystreams"; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -47766,7 +54430,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - "https://www.w3.org/ns/activitystreams"; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -47982,7 +54646,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48024,7 +54688,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48101,7 +54765,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -48320,7 +54984,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48362,7 +55026,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48439,7 +55103,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -48654,7 +55318,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48696,7 +55360,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -48773,7 +55437,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -48988,7 +55652,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49030,7 +55694,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49107,7 +55771,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -49322,7 +55986,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49364,7 +56028,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49441,7 +56105,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji"}]; const compacted = await jsonld.compact( values, docContext, @@ -49654,7 +56318,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49696,7 +56360,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -49773,7 +56437,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -50287,7 +56951,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -50329,7 +56993,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -50406,7 +57070,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -50622,7 +57286,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} , options: { documentLoader?: DocumentLoader, @@ -50671,7 +57335,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;quoteUrl?: URL | null;} = {}, options: { @@ -50795,7 +57459,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} result["type"] = "Note"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -50840,7 +57504,7 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -51101,7 +57765,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} , options: { documentLoader?: DocumentLoader, @@ -51156,7 +57820,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} = {}, options: { @@ -51486,7 +58150,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result["type"] = "OrderedCollection"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -51527,7 +58191,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -51688,7 +58352,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -51812,7 +58476,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -51880,7 +58544,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} = {}, options: { @@ -52254,7 +58918,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle result["type"] = "OrderedCollectionPage"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; return result; } @@ -52313,7 +58977,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","ChatMessage":"http://litepub.social/ns#ChatMessage","sensitive":"as:sensitive","votersCount":"toot:votersCount","Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -52474,7 +59138,7 @@ proofs?: (DataIntegrityProof | URL)[];totalItems?: number | null;current?: Colle const decoded = typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( + && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } @@ -52674,7 +59338,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -53138,7 +59802,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -57557,7 +64221,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result["type"] = "Organization"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; return result; } @@ -57916,7 +64580,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; const compacted = await jsonld.compact( values, docContext, @@ -59216,7 +65880,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -59252,7 +65916,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -59314,7 +65978,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result["type"] = "Page"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -59340,7 +66004,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -59601,7 +66265,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -60065,7 +66729,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -64484,7 +71148,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result["type"] = "Person"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; return result; } @@ -64843,7 +71507,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; const compacted = await jsonld.compact( values, docContext, @@ -66152,7 +72816,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: "cm" | "feet" | "inches" | "km" | "m" | "miles" | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: "cm" | "feet" | "inches" | "km" | "m" | "miles" | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -66266,7 +72930,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: "cm" | "feet" | "inches" | "km" | "m" | "miles" | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: "cm" | "feet" | "inches" | "km" | "m" | "miles" | URL | null;} = {}, options: { @@ -66592,7 +73256,7 @@ proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number result["type"] = "Place"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -66723,7 +73387,7 @@ proofs?: (DataIntegrityProof | URL)[];accuracy?: number | null;altitude?: number ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -67178,7 +73842,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;describes?: Object | URL | null;} , options: { documentLoader?: DocumentLoader, @@ -67227,7 +73891,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;describes?: Object | URL | null;} = {}, options: { @@ -67538,7 +74202,7 @@ proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} result["type"] = "Profile"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -67579,7 +74243,7 @@ proofs?: (DataIntegrityProof | URL)[];describes?: Object | URL | null;} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -67859,7 +74523,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -67978,7 +74642,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -68710,7 +75374,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns",{"toot":"http://joinmastodon.org/ns#","misskey":"https://misskey-hub.net/ns#","fedibird":"http://fedibird.com/ns#","sensitive":"as:sensitive","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","quoteUrl":"as:quoteUrl","_misskey_quote":"misskey:_misskey_quote","quoteUri":"fedibird:quoteUri","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -69157,7 +75821,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69199,7 +75863,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69276,7 +75940,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -69491,7 +76155,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69533,7 +76197,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -69610,7 +76274,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -69843,7 +76507,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];subject?: Object | URL | null;object?: Object | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;subject?: Object | URL | null;object?: Object | URL | null; objects?: (Object | URL)[];relationship?: Object | URL | null; relationships?: (Object | URL)[];} , @@ -69974,7 +76638,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];subject?: Object | URL | null;object?: Object | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;subject?: Object | URL | null;object?: Object | URL | null; objects?: (Object | URL)[];relationship?: Object | URL | null; relationships?: (Object | URL)[];} @@ -71035,7 +77699,7 @@ relationships?: (Object | URL)[];} result["type"] = "Relationship"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -71106,7 +77770,7 @@ relationships?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -71483,7 +78147,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -71525,7 +78189,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -71602,7 +78266,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -71863,7 +78527,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -72327,7 +78991,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];preferredUsername?: string | LanguageString | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;preferredUsername?: string | LanguageString | null; preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; assertionMethods?: (Multikey | URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; @@ -76746,7 +83410,7 @@ get preferredUsernames(): ((string | LanguageString))[] { result["type"] = "Service"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; return result; } @@ -77105,7 +83769,7 @@ get preferredUsernames(): ((string | LanguageString))[] { ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","movedTo":{"@id":"as:movedTo","@type":"@id"},"toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","misskey":"https://misskey-hub.net/ns#","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat"}]; const compacted = await jsonld.compact( values, docContext, @@ -79048,7 +85712,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79090,7 +85754,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79167,7 +85831,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -79382,7 +86046,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79424,7 +86088,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -79501,7 +86165,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -79718,7 +86382,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;deleted?: Temporal.Instant | null;} , options: { documentLoader?: DocumentLoader, @@ -79767,7 +86431,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;deleted?: Temporal.Instant | null;} = {}, options: { @@ -79873,7 +86537,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} result["type"] = "Tombstone"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -79917,7 +86581,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;} ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -80173,7 +86837,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80215,7 +86879,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80292,7 +86956,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -80512,7 +87176,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80554,7 +87218,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80631,7 +87295,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"litepub":"http://litepub.social/ns#","toot":"http://joinmastodon.org/ns#","EmojiReact":"litepub:EmojiReact","Emoji":"toot:Emoji"}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"litepub":"http://litepub.social/ns#","toot":"http://joinmastodon.org/ns#","EmojiReact":"litepub:EmojiReact","Emoji":"toot:Emoji"}]; const compacted = await jsonld.compact( values, docContext, @@ -80849,7 +87513,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80891,7 +87555,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -80968,7 +87632,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"quoteUrl":"as:quoteUrl","toot":"http://joinmastodon.org/ns#","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","ChatMessage":"http://litepub.social/ns#ChatMessage","fedibird":"http://fedibird.com/ns#","quoteUri":"fedibird:quoteUri","misskey":"https://misskey-hub.net/ns#","_misskey_quote":"misskey:_misskey_quote","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1","https://w3id.org/security/data-integrity/v1","https://www.w3.org/ns/did/v1","https://w3id.org/security/multikey/v1","https://gotosocial.org/ns",{"alsoKnownAs":{"@id":"as:alsoKnownAs","@type":"@id"},"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"quoteUrl":"as:quoteUrl","toot":"http://joinmastodon.org/ns#","featured":{"@id":"toot:featured","@type":"@id"},"featuredTags":{"@id":"toot:featuredTags","@type":"@id"},"discoverable":"toot:discoverable","suspended":"toot:suspended","memorial":"toot:memorial","indexable":"toot:indexable","votersCount":{"@id":"toot:votersCount","@type":"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"},"Emoji":"toot:Emoji","Hashtag":"as:Hashtag","schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value","ChatMessage":"http://litepub.social/ns#ChatMessage","fedibird":"http://fedibird.com/ns#","quoteUri":"fedibird:quoteUri","misskey":"https://misskey-hub.net/ns#","_misskey_quote":"misskey:_misskey_quote","_misskey_followedMessage":"misskey:_misskey_followedMessage","isCat":"misskey:isCat","emojiReactions":{"@id":"fedibird:emojiReactions","@type":"@id"}}]; const compacted = await jsonld.compact( values, docContext, @@ -81181,7 +87845,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} , options: { documentLoader?: DocumentLoader, @@ -81217,7 +87881,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | null;} +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;width?: number | null;height?: number | null;} = {}, options: { @@ -81279,7 +87943,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu result["type"] = "Video"; if (this.id != null) result["id"] = this.id.href; - result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + result["@context"] = ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; return result; } @@ -81305,7 +87969,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); } const docContext = options.context ?? - ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, @@ -81519,7 +88183,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -81561,7 +88225,7 @@ tos?: (Object | URL)[];bto?: Object | URL | null; btos?: (Object | URL)[];cc?: Object | URL | null; ccs?: (Object | URL)[];bcc?: Object | URL | null; bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; -proofs?: (DataIntegrityProof | URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;actor?: Application | Group | Organization | Person | Service | URL | null; actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; objects?: (Object | URL)[];target?: Object | URL | null; targets?: (Object | URL)[];result?: Object | URL | null; @@ -81638,7 +88302,7 @@ instruments?: (Object | URL)[];} ); } const docContext = options.context ?? - ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1"]; + ["https://w3id.org/identity/v1","https://www.w3.org/ns/activitystreams","https://w3id.org/security/data-integrity/v1","https://gotosocial.org/ns"]; const compacted = await jsonld.compact( values, docContext, diff --git a/packages/vocab/src/__snapshots__/vocab.test.ts.snap b/packages/vocab/src/__snapshots__/vocab.test.ts.snap index 58b288b60..8a4179ccd 100644 --- a/packages/vocab/src/__snapshots__/vocab.test.ts.snap +++ b/packages/vocab/src/__snapshots__/vocab.test.ts.snap @@ -34,12 +34,766 @@ snapshot[`Deno.inspect(Emoji) [auto] 1`] = ` duration: PT1H, sensitive: true, source: Source {}, - proof: DataIntegrityProof {} + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {} +}' +`; + +snapshot[`Deno.inspect(Emoji) [auto] 2`] = ` +'Emoji { + id: URL "https://example.com/", + attachments: [ URL "https://example.com/" ], + attribution: URL "https://example.com/", + audience: URL "https://example.com/", + contents: [ "hello", "hello" ], + contexts: [ URL "https://example.com/" ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ URL "https://example.com/" ], + icon: URL "https://example.com/", + image: URL "https://example.com/", + replyTarget: URL "https://example.com/", + location: URL "https://example.com/", + preview: URL "https://example.com/", + published: 2024-03-03T08:30:06.796196096Z, + replies: URL "https://example.com/", + shares: URL "https://example.com/", + likes: URL "https://example.com/", + emojiReactions: URL "https://example.com/", + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ URL "https://example.com/" ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: URL "https://example.com/", + bto: URL "https://example.com/", + cc: URL "https://example.com/", + bcc: URL "https://example.com/", + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(Emoji) [auto] 3`] = ` +'Emoji { + id: URL "https://example.com/", + attachments: [ Object {}, Object {} ], + attributions: [ Application {}, Application {} ], + audiences: [ Object {}, Object {} ], + contents: [ "hello", "hello" ], + contexts: [ Object {}, Object {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Object {} ], + icons: [ Image {}, Image {} ], + images: [ Image {}, Image {} ], + replyTargets: [ Object {}, Object {} ], + locations: [ Object {}, Object {} ], + previews: [ Link {}, Link {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Object {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", URL "https://example.com/" ], + tos: [ Object {}, Object {} ], + btos: [ Object {}, Object {} ], + ccs: [ Object {}, Object {} ], + bccs: [ Object {}, Object {} ], + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {} +}' +`; + +snapshot[`Deno.inspect(ChatMessage) [auto] 1`] = ` +'ChatMessage { + id: URL "https://example.com/", + attachments: [ Object {}, Link {}, PropertyValue {} ], + attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + audience: Object {}, + contents: [ "hello", "hello" ], + contexts: [ Object {}, Link {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Link {} ], + icon: Image {}, + image: Image {}, + replyTargets: [ Object {}, Link {} ], + locations: [ Object {}, Link {} ], + previews: [ Link {}, Object {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Link {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: Object {}, + bto: Object {}, + cc: Object {}, + bcc: Object {}, + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + quoteUrl: URL "https://fedify.dev/" +}' +`; + +snapshot[`Deno.inspect(ChatMessage) [auto] 2`] = ` +'ChatMessage { + id: URL "https://example.com/", + attachments: [ URL "https://example.com/" ], + attribution: URL "https://example.com/", + audience: URL "https://example.com/", + contents: [ "hello", "hello" ], + contexts: [ URL "https://example.com/" ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ URL "https://example.com/" ], + icon: URL "https://example.com/", + image: URL "https://example.com/", + replyTarget: URL "https://example.com/", + location: URL "https://example.com/", + preview: URL "https://example.com/", + published: 2024-03-03T08:30:06.796196096Z, + replies: URL "https://example.com/", + shares: URL "https://example.com/", + likes: URL "https://example.com/", + emojiReactions: URL "https://example.com/", + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ URL "https://example.com/" ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: URL "https://example.com/", + bto: URL "https://example.com/", + cc: URL "https://example.com/", + bcc: URL "https://example.com/", + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + quoteUrl: URL "https://fedify.dev/" +}' +`; + +snapshot[`Deno.inspect(ChatMessage) [auto] 3`] = ` +'ChatMessage { + id: URL "https://example.com/", + attachments: [ Object {}, Object {} ], + attributions: [ Application {}, Application {} ], + audiences: [ Object {}, Object {} ], + contents: [ "hello", "hello" ], + contexts: [ Object {}, Object {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Object {} ], + icons: [ Image {}, Image {} ], + images: [ Image {}, Image {} ], + replyTargets: [ Object {}, Object {} ], + locations: [ Object {}, Object {} ], + previews: [ Link {}, Link {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Object {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", URL "https://example.com/" ], + tos: [ Object {}, Object {} ], + btos: [ Object {}, Object {} ], + ccs: [ Object {}, Object {} ], + bccs: [ Object {}, Object {} ], + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + quoteUrl: URL "https://fedify.dev/" +}' +`; + +snapshot[`Deno.inspect(EmojiReact) [auto] 1`] = ` +'EmojiReact { + id: URL "https://example.com/", + attachments: [ Object {}, Link {}, PropertyValue {} ], + attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + audience: Object {}, + contents: [ "hello", "hello" ], + contexts: [ Object {}, Link {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Link {} ], + icon: Image {}, + image: Image {}, + replyTargets: [ Object {}, Link {} ], + locations: [ Object {}, Link {} ], + previews: [ Link {}, Object {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Link {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: Object {}, + bto: Object {}, + cc: Object {}, + bcc: Object {}, + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + object: Object {}, + target: Object {}, + result: Object {}, + origin: Object {}, + instrument: Object {} +}' +`; + +snapshot[`Deno.inspect(EmojiReact) [auto] 2`] = ` +'EmojiReact { + id: URL "https://example.com/", + attachments: [ URL "https://example.com/" ], + attribution: URL "https://example.com/", + audience: URL "https://example.com/", + contents: [ "hello", "hello" ], + contexts: [ URL "https://example.com/" ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ URL "https://example.com/" ], + icon: URL "https://example.com/", + image: URL "https://example.com/", + replyTarget: URL "https://example.com/", + location: URL "https://example.com/", + preview: URL "https://example.com/", + published: 2024-03-03T08:30:06.796196096Z, + replies: URL "https://example.com/", + shares: URL "https://example.com/", + likes: URL "https://example.com/", + emojiReactions: URL "https://example.com/", + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ URL "https://example.com/" ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: URL "https://example.com/", + bto: URL "https://example.com/", + cc: URL "https://example.com/", + bcc: URL "https://example.com/", + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + actor: URL "https://example.com/", + object: URL "https://example.com/", + target: URL "https://example.com/", + result: URL "https://example.com/", + origin: URL "https://example.com/", + instrument: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(EmojiReact) [auto] 3`] = ` +'EmojiReact { + id: URL "https://example.com/", + attachments: [ Object {}, Object {} ], + attributions: [ Application {}, Application {} ], + audiences: [ Object {}, Object {} ], + contents: [ "hello", "hello" ], + contexts: [ Object {}, Object {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Object {} ], + icons: [ Image {}, Image {} ], + images: [ Image {}, Image {} ], + replyTargets: [ Object {}, Object {} ], + locations: [ Object {}, Object {} ], + previews: [ Link {}, Link {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Object {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", URL "https://example.com/" ], + tos: [ Object {}, Object {} ], + btos: [ Object {}, Object {} ], + ccs: [ Object {}, Object {} ], + bccs: [ Object {}, Object {} ], + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + actors: [ Application {}, Application {} ], + objects: [ Object {}, Object {} ], + targets: [ Object {}, Object {} ], + results: [ Object {}, Object {} ], + origins: [ Object {}, Object {} ], + instruments: [ Object {}, Object {} ] +}' +`; + +snapshot[`Deno.inspect(PropertyValue) [auto] 1`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`; + +snapshot[`Deno.inspect(PropertyValue) [auto] 2`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`; + +snapshot[`Deno.inspect(PropertyValue) [auto] 3`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`; + +snapshot[`Deno.inspect(AnnounceAuthorization) [auto] 1`] = ` +'AnnounceAuthorization { + id: URL "https://example.com/", + attachments: [ Object {}, Link {}, PropertyValue {} ], + attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + audience: Object {}, + contents: [ "hello", "hello" ], + contexts: [ Object {}, Link {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Link {} ], + icon: Image {}, + image: Image {}, + replyTargets: [ Object {}, Link {} ], + locations: [ Object {}, Link {} ], + previews: [ Link {}, Object {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Link {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: Object {}, + bto: Object {}, + cc: Object {}, + bcc: Object {}, + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + interactingObject: Object {}, + interactionTarget: Object {} +}' +`; + +snapshot[`Deno.inspect(AnnounceAuthorization) [auto] 2`] = ` +'AnnounceAuthorization { + id: URL "https://example.com/", + attachments: [ URL "https://example.com/" ], + attribution: URL "https://example.com/", + audience: URL "https://example.com/", + contents: [ "hello", "hello" ], + contexts: [ URL "https://example.com/" ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ URL "https://example.com/" ], + icon: URL "https://example.com/", + image: URL "https://example.com/", + replyTarget: URL "https://example.com/", + location: URL "https://example.com/", + preview: URL "https://example.com/", + published: 2024-03-03T08:30:06.796196096Z, + replies: URL "https://example.com/", + shares: URL "https://example.com/", + likes: URL "https://example.com/", + emojiReactions: URL "https://example.com/", + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ URL "https://example.com/" ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: URL "https://example.com/", + bto: URL "https://example.com/", + cc: URL "https://example.com/", + bcc: URL "https://example.com/", + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + interactingObject: URL "https://example.com/", + interactionTarget: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(AnnounceAuthorization) [auto] 3`] = ` +'AnnounceAuthorization { + id: URL "https://example.com/", + attachments: [ Object {}, Object {} ], + attributions: [ Application {}, Application {} ], + audiences: [ Object {}, Object {} ], + contents: [ "hello", "hello" ], + contexts: [ Object {}, Object {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Object {} ], + icons: [ Image {}, Image {} ], + images: [ Image {}, Image {} ], + replyTargets: [ Object {}, Object {} ], + locations: [ Object {}, Object {} ], + previews: [ Link {}, Link {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Object {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", URL "https://example.com/" ], + tos: [ Object {}, Object {} ], + btos: [ Object {}, Object {} ], + ccs: [ Object {}, Object {} ], + bccs: [ Object {}, Object {} ], + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + interactingObject: Object {}, + interactionTarget: Object {} +}' +`; + +snapshot[`Deno.inspect(AnnounceRequest) [auto] 1`] = ` +'AnnounceRequest { + id: URL "https://example.com/", + attachments: [ Object {}, Link {}, PropertyValue {} ], + attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + audience: Object {}, + contents: [ "hello", "hello" ], + contexts: [ Object {}, Link {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Link {} ], + icon: Image {}, + image: Image {}, + replyTargets: [ Object {}, Link {} ], + locations: [ Object {}, Link {} ], + previews: [ Link {}, Object {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Link {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: Object {}, + bto: Object {}, + cc: Object {}, + bcc: Object {}, + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + object: Object {}, + target: Object {}, + result: Object {}, + origin: Object {}, + instrument: Object {} +}' +`; + +snapshot[`Deno.inspect(AnnounceRequest) [auto] 2`] = ` +'AnnounceRequest { + id: URL "https://example.com/", + attachments: [ URL "https://example.com/" ], + attribution: URL "https://example.com/", + audience: URL "https://example.com/", + contents: [ "hello", "hello" ], + contexts: [ URL "https://example.com/" ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ URL "https://example.com/" ], + icon: URL "https://example.com/", + image: URL "https://example.com/", + replyTarget: URL "https://example.com/", + location: URL "https://example.com/", + preview: URL "https://example.com/", + published: 2024-03-03T08:30:06.796196096Z, + replies: URL "https://example.com/", + shares: URL "https://example.com/", + likes: URL "https://example.com/", + emojiReactions: URL "https://example.com/", + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ URL "https://example.com/" ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: URL "https://example.com/", + bto: URL "https://example.com/", + cc: URL "https://example.com/", + bcc: URL "https://example.com/", + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + actor: URL "https://example.com/", + object: URL "https://example.com/", + target: URL "https://example.com/", + result: URL "https://example.com/", + origin: URL "https://example.com/", + instrument: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(AnnounceRequest) [auto] 3`] = ` +'AnnounceRequest { + id: URL "https://example.com/", + attachments: [ Object {}, Object {} ], + attributions: [ Application {}, Application {} ], + audiences: [ Object {}, Object {} ], + contents: [ "hello", "hello" ], + contexts: [ Object {}, Object {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Object {} ], + icons: [ Image {}, Image {} ], + images: [ Image {}, Image {} ], + replyTargets: [ Object {}, Object {} ], + locations: [ Object {}, Object {} ], + previews: [ Link {}, Link {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Object {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", URL "https://example.com/" ], + tos: [ Object {}, Object {} ], + btos: [ Object {}, Object {} ], + ccs: [ Object {}, Object {} ], + bccs: [ Object {}, Object {} ], + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + actors: [ Application {}, Application {} ], + objects: [ Object {}, Object {} ], + targets: [ Object {}, Object {} ], + results: [ Object {}, Object {} ], + origins: [ Object {}, Object {} ], + instruments: [ Object {}, Object {} ] }' `; -snapshot[`Deno.inspect(Emoji) [auto] 2`] = ` -'Emoji { +snapshot[`Deno.inspect(InteractionPolicy) [auto] 1`] = ` +'InteractionPolicy { + id: URL "https://example.com/", + canLike: InteractionRule {}, + canReply: InteractionRule {}, + canAnnounce: InteractionRule {} +}' +`; + +snapshot[`Deno.inspect(InteractionPolicy) [auto] 2`] = ` +'InteractionPolicy { + id: URL "https://example.com/", + canLike: InteractionRule {}, + canReply: InteractionRule {}, + canAnnounce: InteractionRule {} +}' +`; + +snapshot[`Deno.inspect(InteractionPolicy) [auto] 3`] = ` +'InteractionPolicy { + id: URL "https://example.com/", + canLike: InteractionRule {}, + canReply: InteractionRule {}, + canAnnounce: InteractionRule {} +}' +`; + +snapshot[`Deno.inspect(InteractionRule) [auto] 1`] = ` +'InteractionRule { + id: URL "https://example.com/", + automaticApproval: URL "https://example.com/", + manualApproval: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(InteractionRule) [auto] 2`] = ` +'InteractionRule { + id: URL "https://example.com/", + automaticApproval: URL "https://example.com/", + manualApproval: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(InteractionRule) [auto] 3`] = ` +'InteractionRule { + id: URL "https://example.com/", + automaticApprovals: [ URL "https://example.com/", URL "https://example.com/" ], + manualApprovals: [ URL "https://example.com/", URL "https://example.com/" ] +}' +`; + +snapshot[`Deno.inspect(LikeAuthorization) [auto] 1`] = ` +'LikeAuthorization { + id: URL "https://example.com/", + attachments: [ Object {}, Link {}, PropertyValue {} ], + attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + audience: Object {}, + contents: [ "hello", "hello" ], + contexts: [ Object {}, Link {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Link {} ], + icon: Image {}, + image: Image {}, + replyTargets: [ Object {}, Link {} ], + locations: [ Object {}, Link {} ], + previews: [ Link {}, Object {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Link {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: Object {}, + bto: Object {}, + cc: Object {}, + bcc: Object {}, + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + interactingObject: Object {}, + interactionTarget: Object {} +}' +`; + +snapshot[`Deno.inspect(LikeAuthorization) [auto] 2`] = ` +'LikeAuthorization { id: URL "https://example.com/", attachments: [ URL "https://example.com/" ], attribution: URL "https://example.com/", @@ -72,12 +826,19 @@ snapshot[`Deno.inspect(Emoji) [auto] 2`] = ` duration: PT1H, sensitive: true, source: Source {}, - proof: URL "https://example.com/" + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + interactingObject: URL "https://example.com/", + interactionTarget: URL "https://example.com/" }' `; -snapshot[`Deno.inspect(Emoji) [auto] 3`] = ` -'Emoji { +snapshot[`Deno.inspect(LikeAuthorization) [auto] 3`] = ` +'LikeAuthorization { id: URL "https://example.com/", attachments: [ Object {}, Object {} ], attributions: [ Application {}, Application {} ], @@ -110,12 +871,19 @@ snapshot[`Deno.inspect(Emoji) [auto] 3`] = ` duration: PT1H, sensitive: true, source: Source {}, - proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ] + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + interactingObject: Object {}, + interactionTarget: Object {} }' `; -snapshot[`Deno.inspect(ChatMessage) [auto] 1`] = ` -'ChatMessage { +snapshot[`Deno.inspect(LikeRequest) [auto] 1`] = ` +'LikeRequest { id: URL "https://example.com/", attachments: [ Object {}, Link {}, PropertyValue {} ], attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], @@ -149,12 +917,22 @@ snapshot[`Deno.inspect(ChatMessage) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, - quoteUrl: URL "https://fedify.dev/" + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + object: Object {}, + target: Object {}, + result: Object {}, + origin: Object {}, + instrument: Object {} }' `; -snapshot[`Deno.inspect(ChatMessage) [auto] 2`] = ` -'ChatMessage { +snapshot[`Deno.inspect(LikeRequest) [auto] 2`] = ` +'LikeRequest { id: URL "https://example.com/", attachments: [ URL "https://example.com/" ], attribution: URL "https://example.com/", @@ -188,12 +966,22 @@ snapshot[`Deno.inspect(ChatMessage) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", - quoteUrl: URL "https://fedify.dev/" + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + actor: URL "https://example.com/", + object: URL "https://example.com/", + target: URL "https://example.com/", + result: URL "https://example.com/", + origin: URL "https://example.com/", + instrument: URL "https://example.com/" }' `; -snapshot[`Deno.inspect(ChatMessage) [auto] 3`] = ` -'ChatMessage { +snapshot[`Deno.inspect(LikeRequest) [auto] 3`] = ` +'LikeRequest { id: URL "https://example.com/", attachments: [ Object {}, Object {} ], attributions: [ Application {}, Application {} ], @@ -227,12 +1015,157 @@ snapshot[`Deno.inspect(ChatMessage) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], - quoteUrl: URL "https://fedify.dev/" + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + actors: [ Application {}, Application {} ], + objects: [ Object {}, Object {} ], + targets: [ Object {}, Object {} ], + results: [ Object {}, Object {} ], + origins: [ Object {}, Object {} ], + instruments: [ Object {}, Object {} ] }' `; -snapshot[`Deno.inspect(EmojiReact) [auto] 1`] = ` -'EmojiReact { +snapshot[`Deno.inspect(ReplyAuthorization) [auto] 1`] = ` +'ReplyAuthorization { + id: URL "https://example.com/", + attachments: [ Object {}, Link {}, PropertyValue {} ], + attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], + audience: Object {}, + contents: [ "hello", "hello" ], + contexts: [ Object {}, Link {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Link {} ], + icon: Image {}, + image: Image {}, + replyTargets: [ Object {}, Link {} ], + locations: [ Object {}, Link {} ], + previews: [ Link {}, Object {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Link {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: Object {}, + bto: Object {}, + cc: Object {}, + bcc: Object {}, + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + interactingObject: Object {}, + interactionTarget: Object {} +}' +`; + +snapshot[`Deno.inspect(ReplyAuthorization) [auto] 2`] = ` +'ReplyAuthorization { + id: URL "https://example.com/", + attachments: [ URL "https://example.com/" ], + attribution: URL "https://example.com/", + audience: URL "https://example.com/", + contents: [ "hello", "hello" ], + contexts: [ URL "https://example.com/" ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ URL "https://example.com/" ], + icon: URL "https://example.com/", + image: URL "https://example.com/", + replyTarget: URL "https://example.com/", + location: URL "https://example.com/", + preview: URL "https://example.com/", + published: 2024-03-03T08:30:06.796196096Z, + replies: URL "https://example.com/", + shares: URL "https://example.com/", + likes: URL "https://example.com/", + emojiReactions: URL "https://example.com/", + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ URL "https://example.com/" ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", Link {} ], + to: URL "https://example.com/", + bto: URL "https://example.com/", + cc: URL "https://example.com/", + bcc: URL "https://example.com/", + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", + interactingObject: URL "https://example.com/", + interactionTarget: URL "https://example.com/" +}' +`; + +snapshot[`Deno.inspect(ReplyAuthorization) [auto] 3`] = ` +'ReplyAuthorization { + id: URL "https://example.com/", + attachments: [ Object {}, Object {} ], + attributions: [ Application {}, Application {} ], + audiences: [ Object {}, Object {} ], + contents: [ "hello", "hello" ], + contexts: [ Object {}, Object {} ], + names: [ "hello", "hello" ], + endTime: 2024-03-03T08:30:06.796196096Z, + generators: [ Object {}, Object {} ], + icons: [ Image {}, Image {} ], + images: [ Image {}, Image {} ], + replyTargets: [ Object {}, Object {} ], + locations: [ Object {}, Object {} ], + previews: [ Link {}, Link {} ], + published: 2024-03-03T08:30:06.796196096Z, + replies: Collection {}, + shares: Collection {}, + likes: Collection {}, + emojiReactions: Collection {}, + startTime: 2024-03-03T08:30:06.796196096Z, + summaries: [ "hello", "hello" ], + tags: [ Object {}, Object {} ], + updated: 2024-03-03T08:30:06.796196096Z, + urls: [ URL "https://example.com/", URL "https://example.com/" ], + tos: [ Object {}, Object {} ], + btos: [ Object {}, Object {} ], + ccs: [ Object {}, Object {} ], + bccs: [ Object {}, Object {} ], + mediaType: "hello", + duration: PT1H, + sensitive: true, + source: Source {}, + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, + interactingObject: Object {}, + interactionTarget: Object {} +}' +`; + +snapshot[`Deno.inspect(ReplyRequest) [auto] 1`] = ` +'ReplyRequest { id: URL "https://example.com/", attachments: [ Object {}, Link {}, PropertyValue {} ], attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], @@ -266,6 +1199,11 @@ snapshot[`Deno.inspect(EmojiReact) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -275,8 +1213,8 @@ snapshot[`Deno.inspect(EmojiReact) [auto] 1`] = ` }' `; -snapshot[`Deno.inspect(EmojiReact) [auto] 2`] = ` -'EmojiReact { +snapshot[`Deno.inspect(ReplyRequest) [auto] 2`] = ` +'ReplyRequest { id: URL "https://example.com/", attachments: [ URL "https://example.com/" ], attribution: URL "https://example.com/", @@ -310,6 +1248,11 @@ snapshot[`Deno.inspect(EmojiReact) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -319,8 +1262,8 @@ snapshot[`Deno.inspect(EmojiReact) [auto] 2`] = ` }' `; -snapshot[`Deno.inspect(EmojiReact) [auto] 3`] = ` -'EmojiReact { +snapshot[`Deno.inspect(ReplyRequest) [auto] 3`] = ` +'ReplyRequest { id: URL "https://example.com/", attachments: [ Object {}, Object {} ], attributions: [ Application {}, Application {} ], @@ -354,6 +1297,11 @@ snapshot[`Deno.inspect(EmojiReact) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -363,12 +1311,6 @@ snapshot[`Deno.inspect(EmojiReact) [auto] 3`] = ` }' `; -snapshot[`Deno.inspect(PropertyValue) [auto] 1`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`; - -snapshot[`Deno.inspect(PropertyValue) [auto] 2`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`; - -snapshot[`Deno.inspect(PropertyValue) [auto] 3`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`; - snapshot[`Deno.inspect(Export) [auto] 1`] = ` 'Export { id: URL "https://example.com/", @@ -572,6 +1514,11 @@ snapshot[`Deno.inspect(Accept) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -616,6 +1563,11 @@ snapshot[`Deno.inspect(Accept) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -660,6 +1612,11 @@ snapshot[`Deno.inspect(Accept) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -704,6 +1661,11 @@ snapshot[`Deno.inspect(Activity) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -748,6 +1710,11 @@ snapshot[`Deno.inspect(Activity) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -792,6 +1759,11 @@ snapshot[`Deno.inspect(Activity) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -836,6 +1808,11 @@ snapshot[`Deno.inspect(Add) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -880,6 +1857,11 @@ snapshot[`Deno.inspect(Add) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -924,6 +1906,11 @@ snapshot[`Deno.inspect(Add) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -968,6 +1955,11 @@ snapshot[`Deno.inspect(Announce) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -1012,6 +2004,11 @@ snapshot[`Deno.inspect(Announce) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -1056,6 +2053,11 @@ snapshot[`Deno.inspect(Announce) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -1100,6 +2102,11 @@ snapshot[`Deno.inspect(Application) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKey: CryptographicKey {}, assertionMethod: Multikey {}, @@ -1160,6 +2167,11 @@ snapshot[`Deno.inspect(Application) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", preferredUsernames: [ "hello", "hello" ], publicKey: URL "https://example.com/", assertionMethod: URL "https://example.com/", @@ -1220,6 +2232,11 @@ snapshot[`Deno.inspect(Application) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKeys: [ CryptographicKey {}, CryptographicKey {} ], assertionMethods: [ Multikey {}, Multikey {} ], @@ -1280,6 +2297,11 @@ snapshot[`Deno.inspect(Arrive) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -1324,6 +2346,11 @@ snapshot[`Deno.inspect(Arrive) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -1368,6 +2395,11 @@ snapshot[`Deno.inspect(Arrive) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -1412,6 +2444,11 @@ snapshot[`Deno.inspect(Article) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, quoteUrl: URL "https://fedify.dev/" }' `; @@ -1451,6 +2488,11 @@ snapshot[`Deno.inspect(Article) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", quoteUrl: URL "https://fedify.dev/" }' `; @@ -1490,6 +2532,11 @@ snapshot[`Deno.inspect(Article) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, quoteUrl: URL "https://fedify.dev/" }' `; @@ -1529,6 +2576,11 @@ snapshot[`Deno.inspect(Audio) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -1569,6 +2621,11 @@ snapshot[`Deno.inspect(Audio) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", width: 123, height: 123 }' @@ -1609,6 +2666,11 @@ snapshot[`Deno.inspect(Audio) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -1649,6 +2711,11 @@ snapshot[`Deno.inspect(Block) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -1693,6 +2760,11 @@ snapshot[`Deno.inspect(Block) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -1737,6 +2809,11 @@ snapshot[`Deno.inspect(Block) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -1781,6 +2858,11 @@ snapshot[`Deno.inspect(Collection) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -1832,6 +2914,11 @@ snapshot[`Deno.inspect(Collection) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", totalItems: 123, current: URL "https://example.com/", first: URL "https://example.com/", @@ -1883,6 +2970,11 @@ snapshot[`Deno.inspect(Collection) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -1934,6 +3026,11 @@ snapshot[`Deno.inspect(CollectionPage) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -1988,6 +3085,11 @@ snapshot[`Deno.inspect(CollectionPage) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", totalItems: 123, current: URL "https://example.com/", first: URL "https://example.com/", @@ -2042,6 +3144,11 @@ snapshot[`Deno.inspect(CollectionPage) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -2096,6 +3203,11 @@ snapshot[`Deno.inspect(Create) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -2140,6 +3252,11 @@ snapshot[`Deno.inspect(Create) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -2184,6 +3301,11 @@ snapshot[`Deno.inspect(Create) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -2228,6 +3350,11 @@ snapshot[`Deno.inspect(Delete) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -2272,6 +3399,11 @@ snapshot[`Deno.inspect(Delete) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -2316,6 +3448,11 @@ snapshot[`Deno.inspect(Delete) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -2360,6 +3497,11 @@ snapshot[`Deno.inspect(Dislike) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -2404,6 +3546,11 @@ snapshot[`Deno.inspect(Dislike) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -2448,6 +3595,11 @@ snapshot[`Deno.inspect(Dislike) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -2492,6 +3644,11 @@ snapshot[`Deno.inspect(Document) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -2532,6 +3689,11 @@ snapshot[`Deno.inspect(Document) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", width: 123, height: 123 }' @@ -2572,6 +3734,11 @@ snapshot[`Deno.inspect(Document) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -2647,7 +3814,12 @@ snapshot[`Deno.inspect(Event) [auto] 1`] = ` duration: PT1H, sensitive: true, source: Source {}, - proof: DataIntegrityProof {} + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {} }' `; @@ -2685,7 +3857,12 @@ snapshot[`Deno.inspect(Event) [auto] 2`] = ` duration: PT1H, sensitive: true, source: Source {}, - proof: URL "https://example.com/" + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/" }' `; @@ -2723,7 +3900,12 @@ snapshot[`Deno.inspect(Event) [auto] 3`] = ` duration: PT1H, sensitive: true, source: Source {}, - proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ] + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {} }' `; @@ -2762,6 +3944,11 @@ snapshot[`Deno.inspect(Flag) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -2806,6 +3993,11 @@ snapshot[`Deno.inspect(Flag) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -2850,6 +4042,11 @@ snapshot[`Deno.inspect(Flag) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -2894,6 +4091,11 @@ snapshot[`Deno.inspect(Follow) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -2938,6 +4140,11 @@ snapshot[`Deno.inspect(Follow) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -2982,6 +4189,11 @@ snapshot[`Deno.inspect(Follow) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -3026,6 +4238,11 @@ snapshot[`Deno.inspect(Group) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKey: CryptographicKey {}, assertionMethod: Multikey {}, @@ -3086,6 +4303,11 @@ snapshot[`Deno.inspect(Group) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", preferredUsernames: [ "hello", "hello" ], publicKey: URL "https://example.com/", assertionMethod: URL "https://example.com/", @@ -3146,6 +4368,11 @@ snapshot[`Deno.inspect(Group) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKeys: [ CryptographicKey {}, CryptographicKey {} ], assertionMethods: [ Multikey {}, Multikey {} ], @@ -3281,6 +4508,11 @@ snapshot[`Deno.inspect(Ignore) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -3325,6 +4557,11 @@ snapshot[`Deno.inspect(Ignore) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -3369,6 +4606,11 @@ snapshot[`Deno.inspect(Ignore) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -3413,6 +4655,11 @@ snapshot[`Deno.inspect(Image) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -3453,6 +4700,11 @@ snapshot[`Deno.inspect(Image) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", width: 123, height: 123 }' @@ -3493,6 +4745,11 @@ snapshot[`Deno.inspect(Image) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -3533,6 +4790,11 @@ snapshot[`Deno.inspect(IntransitiveActivity) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -3577,6 +4839,11 @@ snapshot[`Deno.inspect(IntransitiveActivity) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -3621,6 +4888,11 @@ snapshot[`Deno.inspect(IntransitiveActivity) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -3665,6 +4937,11 @@ snapshot[`Deno.inspect(Invite) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -3709,6 +4986,11 @@ snapshot[`Deno.inspect(Invite) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -3753,6 +5035,11 @@ snapshot[`Deno.inspect(Invite) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -3797,6 +5084,11 @@ snapshot[`Deno.inspect(Join) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -3841,6 +5133,11 @@ snapshot[`Deno.inspect(Join) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -3885,6 +5182,11 @@ snapshot[`Deno.inspect(Join) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -3929,6 +5231,11 @@ snapshot[`Deno.inspect(Leave) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -3973,6 +5280,11 @@ snapshot[`Deno.inspect(Leave) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -4017,6 +5329,11 @@ snapshot[`Deno.inspect(Leave) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -4061,6 +5378,11 @@ snapshot[`Deno.inspect(Like) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -4105,6 +5427,11 @@ snapshot[`Deno.inspect(Like) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -4149,6 +5476,11 @@ snapshot[`Deno.inspect(Like) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -4268,6 +5600,11 @@ snapshot[`Deno.inspect(Listen) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -4312,6 +5649,11 @@ snapshot[`Deno.inspect(Listen) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -4356,6 +5698,11 @@ snapshot[`Deno.inspect(Listen) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -4475,6 +5822,11 @@ snapshot[`Deno.inspect(Move) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -4519,6 +5871,11 @@ snapshot[`Deno.inspect(Move) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -4563,6 +5920,11 @@ snapshot[`Deno.inspect(Move) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -4607,6 +5969,11 @@ snapshot[`Deno.inspect(Note) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, quoteUrl: URL "https://fedify.dev/" }' `; @@ -4646,6 +6013,11 @@ snapshot[`Deno.inspect(Note) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", quoteUrl: URL "https://fedify.dev/" }' `; @@ -4685,6 +6057,11 @@ snapshot[`Deno.inspect(Note) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, quoteUrl: URL "https://fedify.dev/" }' `; @@ -4723,7 +6100,12 @@ snapshot[`Deno.inspect(Object) [auto] 1`] = ` duration: PT1H, sensitive: true, source: Source {}, - proof: DataIntegrityProof {} + proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {} }' `; @@ -4761,7 +6143,12 @@ snapshot[`Deno.inspect(Object) [auto] 2`] = ` duration: PT1H, sensitive: true, source: Source {}, - proof: URL "https://example.com/" + proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/" }' `; @@ -4799,7 +6186,12 @@ snapshot[`Deno.inspect(Object) [auto] 3`] = ` duration: PT1H, sensitive: true, source: Source {}, - proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ] + proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {} }' `; @@ -4838,6 +6230,11 @@ snapshot[`Deno.inspect(Offer) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -4882,6 +6279,11 @@ snapshot[`Deno.inspect(Offer) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -4926,6 +6328,11 @@ snapshot[`Deno.inspect(Offer) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -4970,6 +6377,11 @@ snapshot[`Deno.inspect(OrderedCollection) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -5021,6 +6433,11 @@ snapshot[`Deno.inspect(OrderedCollection) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", totalItems: 123, current: URL "https://example.com/", first: URL "https://example.com/", @@ -5072,6 +6489,11 @@ snapshot[`Deno.inspect(OrderedCollection) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -5123,6 +6545,11 @@ snapshot[`Deno.inspect(OrderedCollectionPage) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -5178,6 +6605,11 @@ snapshot[`Deno.inspect(OrderedCollectionPage) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", totalItems: 123, current: URL "https://example.com/", first: URL "https://example.com/", @@ -5233,6 +6665,11 @@ snapshot[`Deno.inspect(OrderedCollectionPage) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, totalItems: 123, current: CollectionPage {}, first: CollectionPage {}, @@ -5288,6 +6725,11 @@ snapshot[`Deno.inspect(Organization) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKey: CryptographicKey {}, assertionMethod: Multikey {}, @@ -5348,6 +6790,11 @@ snapshot[`Deno.inspect(Organization) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", preferredUsernames: [ "hello", "hello" ], publicKey: URL "https://example.com/", assertionMethod: URL "https://example.com/", @@ -5408,6 +6855,11 @@ snapshot[`Deno.inspect(Organization) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKeys: [ CryptographicKey {}, CryptographicKey {} ], assertionMethods: [ Multikey {}, Multikey {} ], @@ -5468,6 +6920,11 @@ snapshot[`Deno.inspect(Page) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -5508,6 +6965,11 @@ snapshot[`Deno.inspect(Page) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", width: 123, height: 123 }' @@ -5548,6 +7010,11 @@ snapshot[`Deno.inspect(Page) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -5588,6 +7055,11 @@ snapshot[`Deno.inspect(Person) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKey: CryptographicKey {}, assertionMethod: Multikey {}, @@ -5648,6 +7120,11 @@ snapshot[`Deno.inspect(Person) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", preferredUsernames: [ "hello", "hello" ], publicKey: URL "https://example.com/", assertionMethod: URL "https://example.com/", @@ -5708,6 +7185,11 @@ snapshot[`Deno.inspect(Person) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKeys: [ CryptographicKey {}, CryptographicKey {} ], assertionMethods: [ Multikey {}, Multikey {} ], @@ -5768,6 +7250,11 @@ snapshot[`Deno.inspect(Place) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, accuracy: 12.34, altitude: 12.34, latitude: 12.34, @@ -5812,6 +7299,11 @@ snapshot[`Deno.inspect(Place) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", accuracy: 12.34, altitude: 12.34, latitude: 12.34, @@ -5856,6 +7348,11 @@ snapshot[`Deno.inspect(Place) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, accuracy: 12.34, altitude: 12.34, latitude: 12.34, @@ -5900,6 +7397,11 @@ snapshot[`Deno.inspect(Profile) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, describes: Object {} }' `; @@ -5939,6 +7441,11 @@ snapshot[`Deno.inspect(Profile) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", describes: URL "https://example.com/" }' `; @@ -5978,6 +7485,11 @@ snapshot[`Deno.inspect(Profile) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, describes: Object {} }' `; @@ -6017,6 +7529,11 @@ snapshot[`Deno.inspect(Question) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -6066,6 +7583,11 @@ snapshot[`Deno.inspect(Question) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -6115,6 +7637,11 @@ snapshot[`Deno.inspect(Question) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -6164,6 +7691,11 @@ snapshot[`Deno.inspect(Read) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -6208,6 +7740,11 @@ snapshot[`Deno.inspect(Read) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -6252,6 +7789,11 @@ snapshot[`Deno.inspect(Read) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -6296,6 +7838,11 @@ snapshot[`Deno.inspect(Reject) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -6340,6 +7887,11 @@ snapshot[`Deno.inspect(Reject) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -6384,6 +7936,11 @@ snapshot[`Deno.inspect(Reject) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -6428,6 +7985,11 @@ snapshot[`Deno.inspect(Relationship) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, subject: Object {}, object: Object {}, relationship: Object {} @@ -6469,6 +8031,11 @@ snapshot[`Deno.inspect(Relationship) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", subject: URL "https://example.com/", object: URL "https://example.com/", relationship: URL "https://example.com/" @@ -6510,6 +8077,11 @@ snapshot[`Deno.inspect(Relationship) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, subject: Object {}, objects: [ Object {}, Object {} ], relationships: [ Object {}, Object {} ] @@ -6551,6 +8123,11 @@ snapshot[`Deno.inspect(Remove) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -6595,6 +8172,11 @@ snapshot[`Deno.inspect(Remove) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -6639,6 +8221,11 @@ snapshot[`Deno.inspect(Remove) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -6683,6 +8270,11 @@ snapshot[`Deno.inspect(Service) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKey: CryptographicKey {}, assertionMethod: Multikey {}, @@ -6743,6 +8335,11 @@ snapshot[`Deno.inspect(Service) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", preferredUsernames: [ "hello", "hello" ], publicKey: URL "https://example.com/", assertionMethod: URL "https://example.com/", @@ -6803,6 +8400,11 @@ snapshot[`Deno.inspect(Service) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, preferredUsernames: [ "hello", "hello" ], publicKeys: [ CryptographicKey {}, CryptographicKey {} ], assertionMethods: [ Multikey {}, Multikey {} ], @@ -6887,6 +8489,11 @@ snapshot[`Deno.inspect(TentativeAccept) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -6931,6 +8538,11 @@ snapshot[`Deno.inspect(TentativeAccept) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -6975,6 +8587,11 @@ snapshot[`Deno.inspect(TentativeAccept) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -7019,6 +8636,11 @@ snapshot[`Deno.inspect(TentativeReject) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -7063,6 +8685,11 @@ snapshot[`Deno.inspect(TentativeReject) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -7107,6 +8734,11 @@ snapshot[`Deno.inspect(TentativeReject) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -7151,6 +8783,11 @@ snapshot[`Deno.inspect(Tombstone) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, deleted: 2024-03-03T08:30:06.796196096Z }' `; @@ -7190,6 +8827,11 @@ snapshot[`Deno.inspect(Tombstone) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", deleted: 2024-03-03T08:30:06.796196096Z }' `; @@ -7229,6 +8871,11 @@ snapshot[`Deno.inspect(Tombstone) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, deleted: 2024-03-03T08:30:06.796196096Z }' `; @@ -7268,6 +8915,11 @@ snapshot[`Deno.inspect(Travel) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -7312,6 +8964,11 @@ snapshot[`Deno.inspect(Travel) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -7356,6 +9013,11 @@ snapshot[`Deno.inspect(Travel) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -7400,6 +9062,11 @@ snapshot[`Deno.inspect(Undo) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -7444,6 +9111,11 @@ snapshot[`Deno.inspect(Undo) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -7488,6 +9160,11 @@ snapshot[`Deno.inspect(Undo) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -7532,6 +9209,11 @@ snapshot[`Deno.inspect(Update) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -7576,6 +9258,11 @@ snapshot[`Deno.inspect(Update) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -7620,6 +9307,11 @@ snapshot[`Deno.inspect(Update) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], @@ -7664,6 +9356,11 @@ snapshot[`Deno.inspect(Video) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -7704,6 +9401,11 @@ snapshot[`Deno.inspect(Video) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", width: 123, height: 123 }' @@ -7744,6 +9446,11 @@ snapshot[`Deno.inspect(Video) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, width: 123, height: 123 }' @@ -7784,6 +9491,11 @@ snapshot[`Deno.inspect(View) [auto] 1`] = ` sensitive: true, source: Source {}, proof: DataIntegrityProof {}, + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Group {}, Organization {}, Person {}, Service {} ], object: Object {}, target: Object {}, @@ -7828,6 +9540,11 @@ snapshot[`Deno.inspect(View) [auto] 2`] = ` sensitive: true, source: Source {}, proof: URL "https://example.com/", + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: URL "https://example.com/", + replyAuthorization: URL "https://example.com/", + announceAuthorization: URL "https://example.com/", actor: URL "https://example.com/", object: URL "https://example.com/", target: URL "https://example.com/", @@ -7872,6 +9589,11 @@ snapshot[`Deno.inspect(View) [auto] 3`] = ` sensitive: true, source: Source {}, proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ], + interactionPolicy: InteractionPolicy {}, + approvedBy: URL "https://example.com/", + likeAuthorization: LikeAuthorization {}, + replyAuthorization: ReplyAuthorization {}, + announceAuthorization: AnnounceAuthorization {}, actors: [ Application {}, Application {} ], objects: [ Object {}, Object {} ], targets: [ Object {}, Object {} ], diff --git a/packages/vocab/src/accept.yaml b/packages/vocab/src/accept.yaml index 60ad23cd7..dac114455 100644 --- a/packages/vocab/src/accept.yaml +++ b/packages/vocab/src/accept.yaml @@ -12,4 +12,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/activity.yaml b/packages/vocab/src/activity.yaml index 7a6b46dc0..bb2ebb501 100644 --- a/packages/vocab/src/activity.yaml +++ b/packages/vocab/src/activity.yaml @@ -15,6 +15,7 @@ defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/v1" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: - pluralName: actors diff --git a/packages/vocab/src/add.yaml b/packages/vocab/src/add.yaml index 62051664e..6f3dc1af1 100644 --- a/packages/vocab/src/add.yaml +++ b/packages/vocab/src/add.yaml @@ -13,4 +13,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/announce.yaml b/packages/vocab/src/announce.yaml index b36a72e46..9f0ac44b6 100644 --- a/packages/vocab/src/announce.yaml +++ b/packages/vocab/src/announce.yaml @@ -12,6 +12,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/announceauthorization.yaml b/packages/vocab/src/announceauthorization.yaml new file mode 100644 index 000000000..d3e90907a --- /dev/null +++ b/packages/vocab/src/announceauthorization.yaml @@ -0,0 +1,40 @@ +$schema: ../../vocab-tools/schema.yaml +name: AnnounceAuthorization +compactName: AnnounceAuthorization +uri: "https://gotosocial.org/ns#AnnounceAuthorization" +extends: "https://www.w3.org/ns/activitystreams#Object" +entity: true +description: | + Proves that an {@link Announce} interaction has been approved by + the post author. + + This object is dereferenceable and is used by third parties to verify + that an announce (boost) was authorized. The `attributedTo` property + identifies the post author who granted the approval. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" + +properties: +- singularName: interactingObject + functional: true + compactName: interactingObject + uri: "https://gotosocial.org/ns#interactingObject" + description: | + The URI of the interaction (e.g., an {@link Announce} activity) that + has been authorized. + range: + - "https://www.w3.org/ns/activitystreams#Object" + +- singularName: interactionTarget + functional: true + compactName: interactionTarget + uri: "https://gotosocial.org/ns#interactionTarget" + description: | + The URI of the post that is the target of the authorized announce. + range: + - "https://www.w3.org/ns/activitystreams#Object" diff --git a/packages/vocab/src/announcerequest.yaml b/packages/vocab/src/announcerequest.yaml new file mode 100644 index 000000000..b5ca3b243 --- /dev/null +++ b/packages/vocab/src/announcerequest.yaml @@ -0,0 +1,24 @@ +$schema: ../../vocab-tools/schema.yaml +name: AnnounceRequest +compactName: AnnounceRequest +uri: "https://gotosocial.org/ns#AnnounceRequest" +extends: "https://www.w3.org/ns/activitystreams#Activity" +entity: true +description: | + A request to announce (boost) a post that requires approval from + the post author. + + The `object` property references the post to be announced, and + the `instrument` property contains the {@link Announce} activity itself. + + The post author responds with an {@link Accept} (with an + {@link AnnounceAuthorization} as `result`) or a {@link Reject}. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: +- "https://w3id.org/identity/v1" +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" +properties: [] diff --git a/packages/vocab/src/application.yaml b/packages/vocab/src/application.yaml index a82f7e8b3..a5b01b794 100644 --- a/packages/vocab/src/application.yaml +++ b/packages/vocab/src/application.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - alsoKnownAs: "@id": "as:alsoKnownAs" "@type": "@id" diff --git a/packages/vocab/src/arrive.yaml b/packages/vocab/src/arrive.yaml index cf1eb5f65..d4b3e0c9a 100644 --- a/packages/vocab/src/arrive.yaml +++ b/packages/vocab/src/arrive.yaml @@ -12,4 +12,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/article.yaml b/packages/vocab/src/article.yaml index e0f30bd08..6a95e6b0b 100644 --- a/packages/vocab/src/article.yaml +++ b/packages/vocab/src/article.yaml @@ -8,6 +8,7 @@ description: Represents any kind of multi-paragraph written work. defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/audio.yaml b/packages/vocab/src/audio.yaml index d04fa5572..659334d4b 100644 --- a/packages/vocab/src/audio.yaml +++ b/packages/vocab/src/audio.yaml @@ -8,4 +8,5 @@ description: Represents an audio document of any kind. defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/block.yaml b/packages/vocab/src/block.yaml index 4fef742ab..4b64e49cc 100644 --- a/packages/vocab/src/block.yaml +++ b/packages/vocab/src/block.yaml @@ -13,4 +13,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/chatmessage.yaml b/packages/vocab/src/chatmessage.yaml index 593b5478c..a001f6382 100644 --- a/packages/vocab/src/chatmessage.yaml +++ b/packages/vocab/src/chatmessage.yaml @@ -13,6 +13,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/collection.yaml b/packages/vocab/src/collection.yaml index 11d4db64f..2fb437f75 100644 --- a/packages/vocab/src/collection.yaml +++ b/packages/vocab/src/collection.yaml @@ -13,6 +13,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/collectionpage.yaml b/packages/vocab/src/collectionpage.yaml index 396f74521..dce36b0bb 100644 --- a/packages/vocab/src/collectionpage.yaml +++ b/packages/vocab/src/collectionpage.yaml @@ -11,6 +11,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/create.yaml b/packages/vocab/src/create.yaml index 20d8a4eb2..1d4027d2a 100644 --- a/packages/vocab/src/create.yaml +++ b/packages/vocab/src/create.yaml @@ -9,6 +9,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/delete.yaml b/packages/vocab/src/delete.yaml index 413014158..d9d0a65d0 100644 --- a/packages/vocab/src/delete.yaml +++ b/packages/vocab/src/delete.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/dislike.yaml b/packages/vocab/src/dislike.yaml index 83c50825a..1401fb0dc 100644 --- a/packages/vocab/src/dislike.yaml +++ b/packages/vocab/src/dislike.yaml @@ -9,6 +9,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" Emoji: "toot:Emoji" properties: [] diff --git a/packages/vocab/src/document.yaml b/packages/vocab/src/document.yaml index c312b55d2..c7518f973 100644 --- a/packages/vocab/src/document.yaml +++ b/packages/vocab/src/document.yaml @@ -8,6 +8,7 @@ description: Represents a document of any kind. defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: - singularName: width diff --git a/packages/vocab/src/emojireact.yaml b/packages/vocab/src/emojireact.yaml index 2526e3ae7..1adb02e18 100644 --- a/packages/vocab/src/emojireact.yaml +++ b/packages/vocab/src/emojireact.yaml @@ -10,6 +10,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - litepub: "http://litepub.social/ns#" toot: "http://joinmastodon.org/ns#" EmojiReact: "litepub:EmojiReact" diff --git a/packages/vocab/src/event.yaml b/packages/vocab/src/event.yaml index 192154e46..18cf28890 100644 --- a/packages/vocab/src/event.yaml +++ b/packages/vocab/src/event.yaml @@ -8,4 +8,5 @@ description: Represents any kind of event. defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/flag.yaml b/packages/vocab/src/flag.yaml index 47d8441c2..03e0e7d4a 100644 --- a/packages/vocab/src/flag.yaml +++ b/packages/vocab/src/flag.yaml @@ -12,4 +12,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/follow.yaml b/packages/vocab/src/follow.yaml index 6e8b4a49d..c44e157e2 100644 --- a/packages/vocab/src/follow.yaml +++ b/packages/vocab/src/follow.yaml @@ -16,4 +16,5 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/group.yaml b/packages/vocab/src/group.yaml index a0d3e4d16..62aec9c6d 100644 --- a/packages/vocab/src/group.yaml +++ b/packages/vocab/src/group.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - alsoKnownAs: "@id": "as:alsoKnownAs" "@type": "@id" diff --git a/packages/vocab/src/ignore.yaml b/packages/vocab/src/ignore.yaml index 142a59ee6..21b756fc6 100644 --- a/packages/vocab/src/ignore.yaml +++ b/packages/vocab/src/ignore.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/image.yaml b/packages/vocab/src/image.yaml index 68ce3ca3c..dcf43f8e8 100644 --- a/packages/vocab/src/image.yaml +++ b/packages/vocab/src/image.yaml @@ -5,5 +5,8 @@ uri: "https://www.w3.org/ns/activitystreams#Image" extends: "https://www.w3.org/ns/activitystreams#Document" entity: true description: An image document of any kind. -defaultContext: "https://www.w3.org/ns/activitystreams" +defaultContext: +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/interactionpolicy.yaml b/packages/vocab/src/interactionpolicy.yaml new file mode 100644 index 000000000..d8616b326 --- /dev/null +++ b/packages/vocab/src/interactionpolicy.yaml @@ -0,0 +1,54 @@ +$schema: ../../vocab-tools/schema.yaml +name: InteractionPolicy +compactName: InteractionPolicy +uri: "https://gotosocial.org/ns#InteractionPolicy" +entity: false +typeless: true +description: | + Represents an interaction policy attached to a post, specifying who can + like, reply to, or announce it. Each sub-policy ({@link InteractionRule}) + defines which actors receive automatic or manual approval. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: "https://gotosocial.org/ns" + +properties: +- singularName: canLike + functional: true + compactName: canLike + uri: "https://gotosocial.org/ns#canLike" + untyped: true + description: | + The sub-policy specifying who can like the post. + + When absent, implementations should assume that anyone can like the post + (i.e., `automaticApproval` defaults to the public collection). + range: + - "https://gotosocial.org/ns#InteractionRule" + +- singularName: canReply + functional: true + compactName: canReply + uri: "https://gotosocial.org/ns#canReply" + untyped: true + description: | + The sub-policy specifying who can reply to the post. + + When absent, implementations should assume that anyone can reply + (i.e., `automaticApproval` defaults to the public collection). + range: + - "https://gotosocial.org/ns#InteractionRule" + +- singularName: canAnnounce + functional: true + compactName: canAnnounce + uri: "https://gotosocial.org/ns#canAnnounce" + untyped: true + description: | + The sub-policy specifying who can announce (boost) the post. + + When absent, implementations should assume that anyone can announce + (i.e., `automaticApproval` defaults to the public collection). + range: + - "https://gotosocial.org/ns#InteractionRule" diff --git a/packages/vocab/src/interactionrule.yaml b/packages/vocab/src/interactionrule.yaml new file mode 100644 index 000000000..7fa7fa468 --- /dev/null +++ b/packages/vocab/src/interactionrule.yaml @@ -0,0 +1,50 @@ +$schema: ../../vocab-tools/schema.yaml +name: InteractionRule +compactName: InteractionRule +uri: "https://gotosocial.org/ns#InteractionRule" +entity: false +typeless: true +description: | + Represents a sub-policy within an {@link InteractionPolicy}, defining which + actors receive automatic or manual approval for a specific interaction type + (like, reply, or announce). + + Valid values in the approval lists include: + + - The ActivityStreams public collection + (`https://www.w3.org/ns/activitystreams#Public`) for anyone + - The post author's `followers` or `following` collection URIs + - Individual actor URIs + + When an actor appears in both `automaticApproval` and `manualApproval`, + the more specific value takes precedence (individual URI overrides + collection membership), and `automaticApproval` takes precedence over + `manualApproval` for identical URIs. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: "https://gotosocial.org/ns" + +properties: +- pluralName: automaticApprovals + singularName: automaticApproval + singularAccessor: true + compactName: automaticApproval + uri: "https://gotosocial.org/ns#automaticApproval" + description: | + URIs of actors or collections whose interactions are automatically + approved without requiring manual review by the post author. + range: + - "http://www.w3.org/2001/XMLSchema#anyURI" + +- pluralName: manualApprovals + singularName: manualApproval + singularAccessor: true + compactName: manualApproval + uri: "https://gotosocial.org/ns#manualApproval" + description: | + URIs of actors or collections whose interactions require manual approval + by the post author. The post author can accept or reject these + interactions at their discretion. + range: + - "http://www.w3.org/2001/XMLSchema#anyURI" diff --git a/packages/vocab/src/intransitiveactivity.yaml b/packages/vocab/src/intransitiveactivity.yaml index 7119e99e3..64da53e6e 100644 --- a/packages/vocab/src/intransitiveactivity.yaml +++ b/packages/vocab/src/intransitiveactivity.yaml @@ -12,4 +12,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/invite.yaml b/packages/vocab/src/invite.yaml index eac1e5e17..c0d99db49 100644 --- a/packages/vocab/src/invite.yaml +++ b/packages/vocab/src/invite.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/join.yaml b/packages/vocab/src/join.yaml index 8cb76af4a..6ba9026ca 100644 --- a/packages/vocab/src/join.yaml +++ b/packages/vocab/src/join.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/leave.yaml b/packages/vocab/src/leave.yaml index 272324fff..c4f2991cf 100644 --- a/packages/vocab/src/leave.yaml +++ b/packages/vocab/src/leave.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/like.yaml b/packages/vocab/src/like.yaml index 163394fa8..22037f027 100644 --- a/packages/vocab/src/like.yaml +++ b/packages/vocab/src/like.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" Emoji: "toot:Emoji" properties: [] diff --git a/packages/vocab/src/likeauthorization.yaml b/packages/vocab/src/likeauthorization.yaml new file mode 100644 index 000000000..99e9924c6 --- /dev/null +++ b/packages/vocab/src/likeauthorization.yaml @@ -0,0 +1,39 @@ +$schema: ../../vocab-tools/schema.yaml +name: LikeAuthorization +compactName: LikeAuthorization +uri: "https://gotosocial.org/ns#LikeApproval" +extends: "https://www.w3.org/ns/activitystreams#Object" +entity: true +description: | + Proves that a {@link Like} interaction has been approved by the post author. + + This object is dereferenceable and is used by third parties to verify + that a like was authorized. The `attributedTo` property identifies + the post author who granted the approval. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" + +properties: +- singularName: interactingObject + functional: true + compactName: interactingObject + uri: "https://gotosocial.org/ns#interactingObject" + description: | + The URI of the interaction (e.g., a {@link Like} activity) that + has been authorized. + range: + - "https://www.w3.org/ns/activitystreams#Object" + +- singularName: interactionTarget + functional: true + compactName: interactionTarget + uri: "https://gotosocial.org/ns#interactionTarget" + description: | + The URI of the post that is the target of the authorized interaction. + range: + - "https://www.w3.org/ns/activitystreams#Object" diff --git a/packages/vocab/src/likerequest.yaml b/packages/vocab/src/likerequest.yaml new file mode 100644 index 000000000..addaf6a01 --- /dev/null +++ b/packages/vocab/src/likerequest.yaml @@ -0,0 +1,23 @@ +$schema: ../../vocab-tools/schema.yaml +name: LikeRequest +compactName: LikeRequest +uri: "https://gotosocial.org/ns#LikeRequest" +extends: "https://www.w3.org/ns/activitystreams#Activity" +entity: true +description: | + A request to like a post that requires approval from the post author. + + The `object` property references the post to be liked, and + the `instrument` property contains the {@link Like} activity itself. + + The post author responds with an {@link Accept} (with a + {@link LikeAuthorization} as `result`) or a {@link Reject}. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: +- "https://w3id.org/identity/v1" +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" +properties: [] diff --git a/packages/vocab/src/listen.yaml b/packages/vocab/src/listen.yaml index 688d20453..76805f46b 100644 --- a/packages/vocab/src/listen.yaml +++ b/packages/vocab/src/listen.yaml @@ -9,4 +9,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/move.yaml b/packages/vocab/src/move.yaml index 633a2892e..5d05ac007 100644 --- a/packages/vocab/src/move.yaml +++ b/packages/vocab/src/move.yaml @@ -12,4 +12,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/note.yaml b/packages/vocab/src/note.yaml index 06927ba7d..d91cf1671 100644 --- a/packages/vocab/src/note.yaml +++ b/packages/vocab/src/note.yaml @@ -10,6 +10,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/object.yaml b/packages/vocab/src/object.yaml index 627f0c388..edd0fd06d 100644 --- a/packages/vocab/src/object.yaml +++ b/packages/vocab/src/object.yaml @@ -12,6 +12,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - fedibird: "http://fedibird.com/ns#" sensitive: "as:sensitive" emojiReactions: @@ -402,3 +403,63 @@ properties: A cryptographic proof that can be used to verify the integrity of an object. range: - "https://w3id.org/security#DataIntegrityProof" + +- singularName: interactionPolicy + functional: true + compactName: interactionPolicy + uri: "https://gotosocial.org/ns#interactionPolicy" + untyped: true + description: | + The interaction policy for this object, specifying who can like, reply to, + or announce it. Contains sub-policies (`canLike`, `canReply`, + `canAnnounce`) each defining `automaticApproval` and `manualApproval` + lists. + + When absent, implementations should assume anyone can interact with + the object. Setting this property signals that the server understands + and will enforce interaction controls. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. + range: + - "https://gotosocial.org/ns#InteractionPolicy" + +- singularName: approvedBy + functional: true + compactName: approvedBy + uri: "https://gotosocial.org/ns#approvedBy" + description: | + A URI referencing an authorization object that proves this interaction + was approved by the target post's author. + range: + - "http://www.w3.org/2001/XMLSchema#anyURI" + +- singularName: likeAuthorization + functional: true + compactName: likeAuthorization + uri: "https://gotosocial.org/ns#likeAuthorization" + description: | + A {@link LikeAuthorization} object that proves this like interaction + was approved by the target post's author. + range: + - "https://gotosocial.org/ns#LikeApproval" + +- singularName: replyAuthorization + functional: true + compactName: replyAuthorization + uri: "https://gotosocial.org/ns#replyAuthorization" + description: | + A {@link ReplyAuthorization} object that proves this reply was approved + by the target post's author. + range: + - "https://gotosocial.org/ns#ReplyAuthorization" + +- singularName: announceAuthorization + functional: true + compactName: announceAuthorization + uri: "https://gotosocial.org/ns#announceAuthorization" + description: | + An {@link AnnounceAuthorization} object that proves this announce + (boost) was approved by the target post's author. + range: + - "https://gotosocial.org/ns#AnnounceAuthorization" diff --git a/packages/vocab/src/offer.yaml b/packages/vocab/src/offer.yaml index a1658bb45..5b47447be 100644 --- a/packages/vocab/src/offer.yaml +++ b/packages/vocab/src/offer.yaml @@ -12,4 +12,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/orderedcollection.yaml b/packages/vocab/src/orderedcollection.yaml index 38da7dc0a..d28e3a65a 100644 --- a/packages/vocab/src/orderedcollection.yaml +++ b/packages/vocab/src/orderedcollection.yaml @@ -10,6 +10,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/orderedcollectionpage.yaml b/packages/vocab/src/orderedcollectionpage.yaml index 31ef53148..93d5e4e92 100644 --- a/packages/vocab/src/orderedcollectionpage.yaml +++ b/packages/vocab/src/orderedcollectionpage.yaml @@ -11,6 +11,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/organization.yaml b/packages/vocab/src/organization.yaml index ab47bd162..adcea113b 100644 --- a/packages/vocab/src/organization.yaml +++ b/packages/vocab/src/organization.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - alsoKnownAs: "@id": "as:alsoKnownAs" "@type": "@id" diff --git a/packages/vocab/src/page.yaml b/packages/vocab/src/page.yaml index c3ee9fb80..4e9622323 100644 --- a/packages/vocab/src/page.yaml +++ b/packages/vocab/src/page.yaml @@ -8,4 +8,5 @@ description: Represents a Web Page. defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/person.yaml b/packages/vocab/src/person.yaml index 044896452..5e67e789d 100644 --- a/packages/vocab/src/person.yaml +++ b/packages/vocab/src/person.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - alsoKnownAs: "@id": "as:alsoKnownAs" "@type": "@id" diff --git a/packages/vocab/src/place.yaml b/packages/vocab/src/place.yaml index a4ee078a2..2b83039c8 100644 --- a/packages/vocab/src/place.yaml +++ b/packages/vocab/src/place.yaml @@ -11,6 +11,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: - singularName: accuracy diff --git a/packages/vocab/src/profile.yaml b/packages/vocab/src/profile.yaml index dbaca6066..35e0a008c 100644 --- a/packages/vocab/src/profile.yaml +++ b/packages/vocab/src/profile.yaml @@ -13,6 +13,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: - singularName: describes diff --git a/packages/vocab/src/question.yaml b/packages/vocab/src/question.yaml index 0ec71ceb8..0467fe54a 100644 --- a/packages/vocab/src/question.yaml +++ b/packages/vocab/src/question.yaml @@ -17,6 +17,7 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" - toot: "http://joinmastodon.org/ns#" misskey: "https://misskey-hub.net/ns#" fedibird: "http://fedibird.com/ns#" diff --git a/packages/vocab/src/read.yaml b/packages/vocab/src/read.yaml index 6fc2ec69a..568ae7dc5 100644 --- a/packages/vocab/src/read.yaml +++ b/packages/vocab/src/read.yaml @@ -10,4 +10,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/reject.yaml b/packages/vocab/src/reject.yaml index 1d584f609..e8f5817ba 100644 --- a/packages/vocab/src/reject.yaml +++ b/packages/vocab/src/reject.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/relationship.yaml b/packages/vocab/src/relationship.yaml index aceb726ce..72ce40907 100644 --- a/packages/vocab/src/relationship.yaml +++ b/packages/vocab/src/relationship.yaml @@ -15,6 +15,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: - singularName: subject diff --git a/packages/vocab/src/remove.yaml b/packages/vocab/src/remove.yaml index c3daf58e3..653df59ac 100644 --- a/packages/vocab/src/remove.yaml +++ b/packages/vocab/src/remove.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/replyauthorization.yaml b/packages/vocab/src/replyauthorization.yaml new file mode 100644 index 000000000..c06839c77 --- /dev/null +++ b/packages/vocab/src/replyauthorization.yaml @@ -0,0 +1,39 @@ +$schema: ../../vocab-tools/schema.yaml +name: ReplyAuthorization +compactName: ReplyAuthorization +uri: "https://gotosocial.org/ns#ReplyAuthorization" +extends: "https://www.w3.org/ns/activitystreams#Object" +entity: true +description: | + Proves that a reply interaction has been approved by the post author. + + This object is dereferenceable and is used by third parties to verify + that a reply was authorized. The `attributedTo` property identifies + the post author who granted the approval. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" + +properties: +- singularName: interactingObject + functional: true + compactName: interactingObject + uri: "https://gotosocial.org/ns#interactingObject" + description: | + The URI of the reply object (e.g., a {@link Note}) that has been + authorized. + range: + - "https://www.w3.org/ns/activitystreams#Object" + +- singularName: interactionTarget + functional: true + compactName: interactionTarget + uri: "https://gotosocial.org/ns#interactionTarget" + description: | + The URI of the post that is the target of the authorized reply. + range: + - "https://www.w3.org/ns/activitystreams#Object" diff --git a/packages/vocab/src/replyrequest.yaml b/packages/vocab/src/replyrequest.yaml new file mode 100644 index 000000000..a25730060 --- /dev/null +++ b/packages/vocab/src/replyrequest.yaml @@ -0,0 +1,23 @@ +$schema: ../../vocab-tools/schema.yaml +name: ReplyRequest +compactName: ReplyRequest +uri: "https://gotosocial.org/ns#ReplyRequest" +extends: "https://www.w3.org/ns/activitystreams#Activity" +entity: true +description: | + A request to reply to a post that requires approval from the post author. + + The `object` property references the post to be replied to, and + the `instrument` property contains the reply itself (e.g., a {@link Note}). + + The post author responds with an {@link Accept} (with a + {@link ReplyAuthorization} as `result`) or a {@link Reject}. + + See [GoToSocial interaction controls](https://docs.gotosocial.org/en/latest/federation/interaction_controls/) + for details. +defaultContext: +- "https://w3id.org/identity/v1" +- "https://www.w3.org/ns/activitystreams" +- "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" +properties: [] diff --git a/packages/vocab/src/service.yaml b/packages/vocab/src/service.yaml index 52f00ca90..465bae007 100644 --- a/packages/vocab/src/service.yaml +++ b/packages/vocab/src/service.yaml @@ -11,6 +11,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - alsoKnownAs: "@id": "as:alsoKnownAs" "@type": "@id" diff --git a/packages/vocab/src/tentativeaccept.yaml b/packages/vocab/src/tentativeaccept.yaml index f0bc798b3..c68590a30 100644 --- a/packages/vocab/src/tentativeaccept.yaml +++ b/packages/vocab/src/tentativeaccept.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/tentativereject.yaml b/packages/vocab/src/tentativereject.yaml index 6d29b0186..066a0f0bb 100644 --- a/packages/vocab/src/tentativereject.yaml +++ b/packages/vocab/src/tentativereject.yaml @@ -11,4 +11,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/tombstone.yaml b/packages/vocab/src/tombstone.yaml index 573c71beb..5a4a577d2 100644 --- a/packages/vocab/src/tombstone.yaml +++ b/packages/vocab/src/tombstone.yaml @@ -11,6 +11,7 @@ description: | defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: - singularName: deleted diff --git a/packages/vocab/src/travel.yaml b/packages/vocab/src/travel.yaml index cc451d7c6..6c08edea7 100644 --- a/packages/vocab/src/travel.yaml +++ b/packages/vocab/src/travel.yaml @@ -13,4 +13,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/undo.yaml b/packages/vocab/src/undo.yaml index 14d60ee1c..226662608 100644 --- a/packages/vocab/src/undo.yaml +++ b/packages/vocab/src/undo.yaml @@ -19,6 +19,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - litepub: "http://litepub.social/ns#" toot: "http://joinmastodon.org/ns#" EmojiReact: "litepub:EmojiReact" diff --git a/packages/vocab/src/update.yaml b/packages/vocab/src/update.yaml index 07683edfa..63c3015ee 100644 --- a/packages/vocab/src/update.yaml +++ b/packages/vocab/src/update.yaml @@ -17,6 +17,7 @@ defaultContext: - "https://w3id.org/security/data-integrity/v1" - "https://www.w3.org/ns/did/v1" - "https://w3id.org/security/multikey/v1" +- "https://gotosocial.org/ns" - alsoKnownAs: "@id": "as:alsoKnownAs" "@type": "@id" diff --git a/packages/vocab/src/video.yaml b/packages/vocab/src/video.yaml index f9fc74045..ace9634f1 100644 --- a/packages/vocab/src/video.yaml +++ b/packages/vocab/src/video.yaml @@ -8,4 +8,5 @@ description: Represents a video document of any kind. defaultContext: - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/view.yaml b/packages/vocab/src/view.yaml index 2778acbe2..91a1b642b 100644 --- a/packages/vocab/src/view.yaml +++ b/packages/vocab/src/view.yaml @@ -10,4 +10,5 @@ defaultContext: - "https://w3id.org/identity/v1" - "https://www.w3.org/ns/activitystreams" - "https://w3id.org/security/data-integrity/v1" +- "https://gotosocial.org/ns" properties: [] diff --git a/packages/vocab/src/vocab.test.ts b/packages/vocab/src/vocab.test.ts index 16d0239d0..2105402c3 100644 --- a/packages/vocab/src/vocab.test.ts +++ b/packages/vocab/src/vocab.test.ts @@ -213,6 +213,7 @@ test("Object.toJsonLd()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { fedibird: "http://fedibird.com/ns#", sensitive: "as:sensitive", @@ -244,6 +245,7 @@ test("Note.toJsonLd()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { Emoji: "toot:Emoji", Hashtag: "as:Hashtag", @@ -387,6 +389,7 @@ test({ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", ], type: "Activity", object: { @@ -620,6 +623,7 @@ test("Person.toJsonLd()", async () => { "https://w3id.org/security/data-integrity/v1", "https://www.w3.org/ns/did/v1", "https://w3id.org/security/multikey/v1", + "https://gotosocial.org/ns", { PropertyValue: "schema:PropertyValue", alsoKnownAs: { @@ -1067,6 +1071,7 @@ test("Note.quoteUrl", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", { Emoji: "toot:Emoji", Hashtag: "as:Hashtag", @@ -1206,6 +1211,7 @@ test("Place.fromJsonLd()", async () => { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1", + "https://gotosocial.org/ns", ], type: "Place", name: "Fresno Area", @@ -2288,7 +2294,7 @@ for (const typeUri in types) { contextLoader: mockDocumentLoader, }); deepStrictEqual(jsonLd["@context"], type.defaultContext); - deepStrictEqual(jsonLd.id, "https://example.com/"); + if (type.entity) deepStrictEqual(jsonLd.id, "https://example.com/"); const restored = await cls.fromJsonLd(jsonLd, { documentLoader: mockDocumentLoader, contextLoader: mockDocumentLoader,