From ccfd6cb4739a49fe6ff229c195719f18f61e9f7e Mon Sep 17 00:00:00 2001 From: Lee ByeongJun Date: Sun, 20 Jul 2025 16:37:36 +0900 Subject: [PATCH 01/13] feat: basic debug cli --- cli/debug.test.ts | 47 + cli/debug.tsx | 68 + cli/mod.ts | 2 + fedify/vocab/.vocab.ts | 101677 +++++++++++++++++++++----------------- 4 files changed, 56651 insertions(+), 45143 deletions(-) create mode 100644 cli/debug.test.ts create mode 100644 cli/debug.tsx diff --git a/cli/debug.test.ts b/cli/debug.test.ts new file mode 100644 index 00000000..5911c7a3 --- /dev/null +++ b/cli/debug.test.ts @@ -0,0 +1,47 @@ +import { assertEquals, assertExists } from "@std/assert"; +import { command } from "./debug.tsx"; +import type { DebugOptions } from "./debug.tsx"; + +Deno.test("debug command exists", () => { + assertExists(command); + // Command exists and is properly exported +}); + +Deno.test("debug command has correct description", () => { + const description = command.getDescription(); + assertExists(description); + assertEquals( + description.includes("ActivityPub debug dashboard"), + true, + ); +}); + +Deno.test("debug command has required options", () => { + const options = command.getOptions(); + + // Check that we have options + assertExists(options); + assertEquals(options.length > 0, true); + + // Check option names exist + const optionNames = options.map((opt) => opt.name); + assertEquals(optionNames.includes("port"), true); + assertEquals(optionNames.includes("no-browser"), true); +}); + +Deno.test("debug options interface exports correctly", () => { + // Type check only - ensures DebugOptions interface is properly exported + const options: DebugOptions = { + port: 8080, + browser: true, + }; + + assertEquals(typeof options.port, "number"); + assertEquals(typeof options.browser, "boolean"); +}); + +Deno.test("debug command has action handler", () => { + // Verify the command has an action handler + const hasAction = typeof command.action === "function"; + assertEquals(hasAction, true); +}); diff --git a/cli/debug.tsx b/cli/debug.tsx new file mode 100644 index 00000000..97e3ec43 --- /dev/null +++ b/cli/debug.tsx @@ -0,0 +1,68 @@ +/** @jsx react-jsx */ +/** @jsxImportSource hono/jsx */ +import { Command } from "@cliffy/command"; +import { getLogger } from "@logtape/logtape"; +import ora from "ora"; + +/** + * Options for the debug command. + */ +export interface DebugOptions { + /** Port number for the debug dashboard server */ + port: number; + /** Disable opening browser automatically */ + browser: boolean; +} + +const logger = getLogger(["fedify", "cli", "debug"]); + +export const command = new Command() + .description( + "Start an ActivityPub debug dashboard that monitors and displays " + + "federation activities in real-time.", + ) + .option( + "-p, --port=", + "Port number for the debug dashboard server.", + { default: 8080 }, + ) + .option( + "--no-browser", + "Do not automatically open the dashboard in a web browser.", + ) + .action(async (options) => { + const spinner = ora({ + text: "Starting ActivityPub debug dashboard...", + discardStdin: false, + }).start(); + + try { + // TODO: Implement the actual debug dashboard server + spinner.succeed( + `Debug dashboard would start on port ${options.port}`, + ); + + logger.info("Debug dashboard started with options: {options}", { + options: { + port: options.port, + browser: options.browser, + }, + }); + + // Placeholder for future implementation + console.log("\nDebug dashboard configuration:"); + console.log(` Port: ${options.port}`); + console.log(` Auto-open browser: ${options.browser ? "Yes" : "No"}`); + + console.log( + "\nPress Ctrl+C to stop the debug dashboard.", + ); + + // Keep the process running until interrupted + await new Promise(() => {}); + } catch (error) { + spinner.fail("Failed to start debug dashboard"); + logger.error("Error starting debug dashboard: {error}", { error }); + throw error; + } + }); diff --git a/cli/mod.ts b/cli/mod.ts index 7c0a888a..4ba9ef19 100644 --- a/cli/mod.ts +++ b/cli/mod.ts @@ -4,6 +4,7 @@ import { configure, getConsoleSink } from "@logtape/logtape"; import { AsyncLocalStorage } from "node:async_hooks"; import { DEFAULT_CACHE_DIR, setCacheDir } from "./cache.ts"; import metadata from "./deno.json" with { type: "json" }; +import { command as debug } from "./debug.tsx"; import { command as inbox } from "./inbox.tsx"; import { command as init } from "./init.ts"; import { logFile, recordingSink } from "./log.ts"; @@ -60,6 +61,7 @@ const command = new Command() }, }) .default("help") + .command("debug", debug) .command("init", init) .command("lookup", lookup) .command("inbox", inbox) diff --git a/fedify/vocab/.vocab.ts b/fedify/vocab/.vocab.ts index a59641b0..d1f73aa0 100644 --- a/fedify/vocab/.vocab.ts +++ b/fedify/vocab/.vocab.ts @@ -2,108 +2,116 @@ // @ts-ignore TS7016 import jsonld from "jsonld"; import { getLogger } from "@logtape/logtape"; -import { type Span, SpanStatusCode, type TracerProvider, trace } - from "@opentelemetry/api"; -import { LanguageTag, parseLanguageTag } - from "@phensley/language-tag"; -import { decode as decodeMultibase, encode as encodeMultibase } - from "../runtime/multibase/index.ts";import { type DocumentLoader, getDocumentLoader, type RemoteDocument } - from "../runtime/docloader.ts"; import { - exportSpki, - exportMultibaseKey, - importPem, - importMultibaseKey, - } from "../runtime/key.ts"; + type Span, + SpanStatusCode, + trace, + type TracerProvider, +} from "@opentelemetry/api"; +import { LanguageTag, parseLanguageTag } from "@phensley/language-tag"; +import { + decode as decodeMultibase, + encode as encodeMultibase, +} from "../runtime/multibase/index.ts"; +import { + type DocumentLoader, + getDocumentLoader, + type RemoteDocument, +} from "../runtime/docloader.ts"; +import { + exportMultibaseKey, + exportSpki, + importMultibaseKey, + importPem, +} from "../runtime/key.ts"; import { LanguageString } from "../runtime/langstr.ts"; - /** Describes an object of any kind. The Object type serves as the base type for * most of the other kinds of objects defined in the Activity Vocabulary, * including other Core types such as {@link Activity}, * {@link IntransitiveActivity}, {@link Collection} and * {@link OrderedCollection}. - * */ export class Object { + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; - 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 _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } - 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 Object}: `https://www.w3.org/ns/activitystreams#Object`. - */ - static get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Object"); - } - #_49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; -#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; -#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; -#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; -#_3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; -#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; -#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime: (Temporal.Instant)[] = []; -#_86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; -#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; -#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; -#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; -#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; -#_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; -#_5e258TDXtuhaFRPZiGoDfEpjdMr_published: (Temporal.Instant)[] = []; -#_7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; -#_3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; -#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; -#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; -#_2w3Jmue4up8iVDUA51WZqomEF438_startTime: (Temporal.Instant)[] = []; -#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = []; -#_5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; -#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated: (Temporal.Instant)[] = []; -#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url: ((URL | Link))[] = []; -#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; -#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; -#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; -#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; -#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType: (string)[] = []; -#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration: (Temporal.Duration)[] = []; -#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive: (boolean)[] = []; -#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source: (Source)[] = []; -#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } + + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } + + /** + * The type URI of {@link Object}: `https://www.w3.org/ns/activitystreams#Object`. + */ + static get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Object"); + } + #_49BipA5dq9eoH8LX8xdsVumveTca_attachment: + (Object | Link | PropertyValue | URL)[] = []; + #_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: + (Application | Group | Organization | Person | Service | URL)[] = []; + #_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; + #_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; + #_3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; + #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; + #_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime: (Temporal.Instant)[] = []; + #_86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; + #_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; + #_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; + #_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; + #_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; + #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; + #_5e258TDXtuhaFRPZiGoDfEpjdMr_published: (Temporal.Instant)[] = []; + #_7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; + #_3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; + #_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; + #_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; + #_2w3Jmue4up8iVDUA51WZqomEF438_startTime: (Temporal.Instant)[] = []; + #_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = []; + #_5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; + #_385aB7ySixcf5Un6z3VsWmThgCzQ_updated: (Temporal.Instant)[] = []; + #_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url: ((URL | Link))[] = []; + #_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; + #_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; + #_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; + #_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; + #_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType: (string)[] = []; + #_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration: (Temporal.Duration)[] = []; + #_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive: (boolean)[] = []; + #_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source: (Source)[] = []; + #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; /** * Constructs a new instance of Object with the given values. @@ -111,34 +119,71 @@ export class Object { * @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)[];} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + 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)[]; + }, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; @@ -154,1568 +199,1867 @@ proofs?: (DataIntegrityProof | URL)[];} } else { throw new TypeError("The id must be a URL."); } - - if ("attachments" in values && values.attachments != null) { - - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments; - } else { - throw new TypeError( - "The attachments must be an array of type " + - "Object | Link | PropertyValue | URL" + ".", - ); - } - } - - if ("attribution" in values && values.attribution != null) { - if (values.attribution instanceof Application || values.attribution instanceof Group || values.attribution instanceof Organization || values.attribution instanceof Person || values.attribution instanceof Service || values.attribution instanceof URL) { - // @ts-ignore: type is checked above. - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [values.attribution]; - } else { - throw new TypeError( - "The attribution must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("attributions" in values && values.attributions != null) { - - if ("attribution" in values && - values.attribution != null) { - throw new TypeError( - "Cannot initialize both attribution and " + - "attributions at the same time.", - ); - } - - if (Array.isArray(values.attributions) && - values.attributions.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.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions; - } else { - throw new TypeError( - "The attributions must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("audience" in values && values.audience != null) { - if (values.audience instanceof Object || values.audience instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; - } else { - throw new TypeError( - "The audience must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("audiences" in values && values.audiences != null) { - - if ("audience" in values && - values.audience != null) { - throw new TypeError( - "Cannot initialize both audience and " + - "audiences at the same time.", - ); - } - - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences; - } else { - throw new TypeError( - "The audiences must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("content" in values && values.content != null) { - if (typeof values.content === "string" || values.content instanceof LanguageString) { - // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = [values.content]; - } else { - throw new TypeError( - "The content must be of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("contents" in values && values.contents != null) { - - if ("content" in values && - values.content != null) { - throw new TypeError( - "Cannot initialize both content and " + - "contents at the same time.", - ); - } - - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents; - } else { - throw new TypeError( - "The contents must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("contexts" in values && values.contexts != null) { - - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts; - } else { - throw new TypeError( - "The contexts must be an array of type " + - "Object | Link | 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 ("names" in values && values.names != null) { - - if ("name" in values && - values.name != null) { - throw new TypeError( - "Cannot initialize both name and " + - "names at the same time.", - ); - } - - if (Array.isArray(values.names) && - values.names.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names; - } else { - throw new TypeError( - "The names must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("endTime" in values && values.endTime != null) { - if (values.endTime instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime]; - } else { - throw new TypeError( - "The endTime must be of type " + - "Temporal.Instant" + ".", - ); - } - } - - if ("generators" in values && values.generators != null) { - - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators; - } else { - throw new TypeError( - "The generators must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("icon" in values && values.icon != null) { - if (values.icon instanceof Image || values.icon instanceof URL) { - // @ts-ignore: type is checked above. - this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; - } else { - throw new TypeError( - "The icon must be of type " + - "Image | URL" + ".", - ); - } - } - - if ("icons" in values && values.icons != null) { - - if ("icon" in values && - values.icon != null) { - throw new TypeError( - "Cannot initialize both icon and " + - "icons at the same time.", - ); - } - - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons; - } else { - throw new TypeError( - "The icons must be an array of type " + - "Image | URL" + ".", - ); - } - } - - if ("image" in values && values.image != null) { - if (values.image instanceof Image || values.image instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; - } else { - throw new TypeError( - "The image must be of type " + - "Image | URL" + ".", - ); - } - } - - if ("images" in values && values.images != null) { - - if ("image" in values && - values.image != null) { - throw new TypeError( - "Cannot initialize both image and " + - "images at the same time.", - ); - } - - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images; - } else { - throw new TypeError( - "The images must be an array of type " + - "Image | URL" + ".", - ); - } - } - - if ("replyTarget" in values && values.replyTarget != null) { - if (values.replyTarget instanceof Object || values.replyTarget instanceof Link || values.replyTarget instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; - } else { - throw new TypeError( - "The replyTarget must be of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("replyTargets" in values && values.replyTargets != null) { - - if ("replyTarget" in values && - values.replyTarget != null) { - throw new TypeError( - "Cannot initialize both replyTarget and " + - "replyTargets at the same time.", - ); - } - - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets; - } else { - throw new TypeError( - "The replyTargets must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("location" in values && values.location != null) { - if (values.location instanceof Object || values.location instanceof Link || values.location instanceof URL) { - // @ts-ignore: type is checked above. - this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; - } else { - throw new TypeError( - "The location must be of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("locations" in values && values.locations != null) { - - if ("location" in values && - values.location != null) { - throw new TypeError( - "Cannot initialize both location and " + - "locations at the same time.", - ); - } - - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations; - } else { - throw new TypeError( - "The locations must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("preview" in values && values.preview != null) { - if (values.preview instanceof Link || values.preview instanceof Object || values.preview instanceof URL) { - // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; - } else { - throw new TypeError( - "The preview must be of type " + - "Link | Object | URL" + ".", - ); - } - } - - if ("previews" in values && values.previews != null) { - - if ("preview" in values && - values.preview != null) { - throw new TypeError( - "Cannot initialize both preview and " + - "previews at the same time.", - ); - } - - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews; - } else { - throw new TypeError( - "The previews must be an array of type " + - "Link | Object | URL" + ".", - ); - } - } - - if ("published" in values && values.published != null) { - if (values.published instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published]; - } else { - throw new TypeError( - "The published must be of type " + - "Temporal.Instant" + ".", - ); - } - } - - if ("replies" in values && values.replies != null) { - if (values.replies instanceof Collection || values.replies instanceof URL) { - // @ts-ignore: type is checked above. - this.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; - } else { - throw new TypeError( - "The replies must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("shares" in values && values.shares != null) { - if (values.shares instanceof Collection || values.shares instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; - } else { - throw new TypeError( - "The shares must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("likes" in values && values.likes != null) { - if (values.likes instanceof Collection || values.likes instanceof URL) { - // @ts-ignore: type is checked above. - this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; - } else { - throw new TypeError( - "The likes must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("emojiReactions" in values && values.emojiReactions != null) { - if (values.emojiReactions instanceof Collection || values.emojiReactions instanceof URL) { - // @ts-ignore: type is checked above. - this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions]; - } else { - throw new TypeError( - "The emojiReactions must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("startTime" in values && values.startTime != null) { - if (values.startTime instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime]; - } else { - throw new TypeError( - "The startTime must be of type " + - "Temporal.Instant" + ".", - ); - } - } - - if ("summary" in values && values.summary != null) { - if (typeof values.summary === "string" || values.summary instanceof LanguageString) { - // @ts-ignore: type is checked above. - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary]; - } else { - throw new TypeError( - "The summary must be of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("summaries" in values && values.summaries != null) { - - if ("summary" in values && - values.summary != null) { - throw new TypeError( - "Cannot initialize both summary and " + - "summaries at the same time.", - ); - } - - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries; - } else { - throw new TypeError( - "The summaries must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("tags" in values && values.tags != null) { - - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags; - } else { - throw new TypeError( - "The tags must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("updated" in values && values.updated != null) { - if (values.updated instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated]; - } else { - throw new TypeError( - "The updated must be of type " + - "Temporal.Instant" + ".", - ); - } - } - - if ("url" in values && values.url != null) { - if (values.url instanceof URL || values.url instanceof Link) { - // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url]; - } else { - throw new TypeError( - "The url must be of type " + - "URL | Link" + ".", - ); - } - } - - if ("urls" in values && values.urls != null) { - - if ("url" in values && - values.url != null) { - throw new TypeError( - "Cannot initialize both url and " + - "urls at the same time.", - ); - } - - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { - // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls; - } else { - throw new TypeError( - "The urls must be an array of type " + - "URL | Link" + ".", - ); - } - } - - if ("to" in values && values.to != null) { - if (values.to instanceof Object || values.to instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; - } else { - throw new TypeError( - "The to must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("tos" in values && values.tos != null) { - - if ("to" in values && - values.to != null) { - throw new TypeError( - "Cannot initialize both to and " + - "tos at the same time.", - ); - } - - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos; - } else { - throw new TypeError( - "The tos must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("bto" in values && values.bto != null) { - if (values.bto instanceof Object || values.bto instanceof URL) { - // @ts-ignore: type is checked above. - this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; - } else { - throw new TypeError( - "The bto must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("btos" in values && values.btos != null) { - - if ("bto" in values && - values.bto != null) { - throw new TypeError( - "Cannot initialize both bto and " + - "btos at the same time.", - ); - } - - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos; - } else { - throw new TypeError( - "The btos must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("cc" in values && values.cc != null) { - if (values.cc instanceof Object || values.cc instanceof URL) { - // @ts-ignore: type is checked above. - this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; - } else { - throw new TypeError( - "The cc must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("ccs" in values && values.ccs != null) { - - if ("cc" in values && - values.cc != null) { - throw new TypeError( - "Cannot initialize both cc and " + - "ccs at the same time.", - ); - } - - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs; - } else { - throw new TypeError( - "The ccs must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("bcc" in values && values.bcc != null) { - if (values.bcc instanceof Object || values.bcc instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; - } else { - throw new TypeError( - "The bcc must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("bccs" in values && values.bccs != null) { - - if ("bcc" in values && - values.bcc != null) { - throw new TypeError( - "Cannot initialize both bcc and " + - "bccs at the same time.", - ); - } - - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs; - } else { - throw new TypeError( - "The bccs must be an array of type " + - "Object | URL" + ".", - ); - } - } - - if ("mediaType" in values && values.mediaType != null) { - if (typeof values.mediaType === "string") { - // @ts-ignore: type is checked above. - this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType]; - } else { - throw new TypeError( - "The mediaType must be of type " + - "string" + ".", - ); - } - } - - if ("duration" in values && values.duration != null) { - if (values.duration instanceof Temporal.Duration) { - // @ts-ignore: type is checked above. - this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration]; - } else { - throw new TypeError( - "The duration must be of type " + - "Temporal.Duration" + ".", - ); - } - } - - if ("sensitive" in values && values.sensitive != null) { - if (typeof values.sensitive === "boolean") { - // @ts-ignore: type is checked above. - this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive]; - } else { - throw new TypeError( - "The sensitive must be of type " + - "boolean" + ".", - ); - } - } - - if ("source" in values && values.source != null) { - if (values.source instanceof Source) { - // @ts-ignore: type is checked above. - this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = [values.source]; - } else { - throw new TypeError( - "The source must be of type " + - "Source" + ".", - ); - } - } - - if ("proof" in values && values.proof != null) { - if (values.proof instanceof DataIntegrityProof || values.proof instanceof URL) { - // @ts-ignore: type is checked above. - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; - } else { - throw new TypeError( - "The proof must be of type " + - "DataIntegrityProof | URL" + ".", - ); - } - } - - if ("proofs" in values && values.proofs != null) { - - if ("proof" in values && - values.proof != null) { - throw new TypeError( - "Cannot initialize both proof and " + - "proofs at the same time.", - ); - } - - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs; - } else { - throw new TypeError( - "The proofs must be an array of type " + - "DataIntegrityProof | URL" + ".", - ); - } - } + + if ("attachments" in values && values.attachments != null) { + if ( + Array.isArray(values.attachments) && + values.attachments.every((v) => + v instanceof Object || v instanceof Link || + v instanceof PropertyValue || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments; + } else { + throw new TypeError( + "The attachments must be an array of type " + + "Object | Link | PropertyValue | URL" + ".", + ); + } + } + + if ("attribution" in values && values.attribution != null) { + if ( + values.attribution instanceof Application || + values.attribution instanceof Group || + values.attribution instanceof Organization || + values.attribution instanceof Person || + values.attribution instanceof Service || + values.attribution instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [values.attribution]; + } else { + throw new TypeError( + "The attribution must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("attributions" in values && values.attributions != null) { + if ( + "attribution" in values && + values.attribution != null + ) { + throw new TypeError( + "Cannot initialize both attribution and " + + "attributions at the same time.", + ); + } + + if ( + Array.isArray(values.attributions) && + values.attributions.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.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions; + } else { + throw new TypeError( + "The attributions must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("audience" in values && values.audience != null) { + if (values.audience instanceof Object || values.audience instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; + } else { + throw new TypeError( + "The audience must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("audiences" in values && values.audiences != null) { + if ( + "audience" in values && + values.audience != null + ) { + throw new TypeError( + "Cannot initialize both audience and " + + "audiences at the same time.", + ); + } + + if ( + Array.isArray(values.audiences) && + values.audiences.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences; + } else { + throw new TypeError( + "The audiences must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("content" in values && values.content != null) { + if ( + typeof values.content === "string" || + values.content instanceof LanguageString + ) { + // @ts-ignore: type is checked above. + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = [values.content]; + } else { + throw new TypeError( + "The content must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("contents" in values && values.contents != null) { + if ( + "content" in values && + values.content != null + ) { + throw new TypeError( + "Cannot initialize both content and " + + "contents at the same time.", + ); + } + + if ( + Array.isArray(values.contents) && + values.contents.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents; + } else { + throw new TypeError( + "The contents must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("contexts" in values && values.contexts != null) { + if ( + Array.isArray(values.contexts) && + values.contexts.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts; + } else { + throw new TypeError( + "The contexts must be an array of type " + + "Object | Link | 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 ("names" in values && values.names != null) { + if ( + "name" in values && + values.name != null + ) { + throw new TypeError( + "Cannot initialize both name and " + + "names at the same time.", + ); + } + + if ( + Array.isArray(values.names) && + values.names.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names; + } else { + throw new TypeError( + "The names must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("endTime" in values && values.endTime != null) { + if (values.endTime instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime]; + } else { + throw new TypeError( + "The endTime must be of type " + + "Temporal.Instant" + ".", + ); + } + } + + if ("generators" in values && values.generators != null) { + if ( + Array.isArray(values.generators) && + values.generators.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators; + } else { + throw new TypeError( + "The generators must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("icon" in values && values.icon != null) { + if (values.icon instanceof Image || values.icon instanceof URL) { + // @ts-ignore: type is checked above. + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; + } else { + throw new TypeError( + "The icon must be of type " + + "Image | URL" + ".", + ); + } + } + + if ("icons" in values && values.icons != null) { + if ( + "icon" in values && + values.icon != null + ) { + throw new TypeError( + "Cannot initialize both icon and " + + "icons at the same time.", + ); + } + + if ( + Array.isArray(values.icons) && + values.icons.every((v) => v instanceof Image || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons; + } else { + throw new TypeError( + "The icons must be an array of type " + + "Image | URL" + ".", + ); + } + } + + if ("image" in values && values.image != null) { + if (values.image instanceof Image || values.image instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; + } else { + throw new TypeError( + "The image must be of type " + + "Image | URL" + ".", + ); + } + } + + if ("images" in values && values.images != null) { + if ( + "image" in values && + values.image != null + ) { + throw new TypeError( + "Cannot initialize both image and " + + "images at the same time.", + ); + } + + if ( + Array.isArray(values.images) && + values.images.every((v) => v instanceof Image || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images; + } else { + throw new TypeError( + "The images must be an array of type " + + "Image | URL" + ".", + ); + } + } + + if ("replyTarget" in values && values.replyTarget != null) { + if ( + values.replyTarget instanceof Object || + values.replyTarget instanceof Link || values.replyTarget instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; + } else { + throw new TypeError( + "The replyTarget must be of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("replyTargets" in values && values.replyTargets != null) { + if ( + "replyTarget" in values && + values.replyTarget != null + ) { + throw new TypeError( + "Cannot initialize both replyTarget and " + + "replyTargets at the same time.", + ); + } + + if ( + Array.isArray(values.replyTargets) && + values.replyTargets.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets; + } else { + throw new TypeError( + "The replyTargets must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("location" in values && values.location != null) { + if ( + values.location instanceof Object || values.location instanceof Link || + values.location instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; + } else { + throw new TypeError( + "The location must be of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("locations" in values && values.locations != null) { + if ( + "location" in values && + values.location != null + ) { + throw new TypeError( + "Cannot initialize both location and " + + "locations at the same time.", + ); + } + + if ( + Array.isArray(values.locations) && + values.locations.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations; + } else { + throw new TypeError( + "The locations must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("preview" in values && values.preview != null) { + if ( + values.preview instanceof Link || values.preview instanceof Object || + values.preview instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; + } else { + throw new TypeError( + "The preview must be of type " + + "Link | Object | URL" + ".", + ); + } + } + + if ("previews" in values && values.previews != null) { + if ( + "preview" in values && + values.preview != null + ) { + throw new TypeError( + "Cannot initialize both preview and " + + "previews at the same time.", + ); + } + + if ( + Array.isArray(values.previews) && + values.previews.every((v) => + v instanceof Link || v instanceof Object || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews; + } else { + throw new TypeError( + "The previews must be an array of type " + + "Link | Object | URL" + ".", + ); + } + } + + if ("published" in values && values.published != null) { + if (values.published instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published]; + } else { + throw new TypeError( + "The published must be of type " + + "Temporal.Instant" + ".", + ); + } + } + + if ("replies" in values && values.replies != null) { + if ( + values.replies instanceof Collection || values.replies instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; + } else { + throw new TypeError( + "The replies must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("shares" in values && values.shares != null) { + if (values.shares instanceof Collection || values.shares instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; + } else { + throw new TypeError( + "The shares must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("likes" in values && values.likes != null) { + if (values.likes instanceof Collection || values.likes instanceof URL) { + // @ts-ignore: type is checked above. + this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; + } else { + throw new TypeError( + "The likes must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("emojiReactions" in values && values.emojiReactions != null) { + if ( + values.emojiReactions instanceof Collection || + values.emojiReactions instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [ + values.emojiReactions, + ]; + } else { + throw new TypeError( + "The emojiReactions must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("startTime" in values && values.startTime != null) { + if (values.startTime instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime]; + } else { + throw new TypeError( + "The startTime must be of type " + + "Temporal.Instant" + ".", + ); + } + } + + if ("summary" in values && values.summary != null) { + if ( + typeof values.summary === "string" || + values.summary instanceof LanguageString + ) { + // @ts-ignore: type is checked above. + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary]; + } else { + throw new TypeError( + "The summary must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("summaries" in values && values.summaries != null) { + if ( + "summary" in values && + values.summary != null + ) { + throw new TypeError( + "Cannot initialize both summary and " + + "summaries at the same time.", + ); + } + + if ( + Array.isArray(values.summaries) && + values.summaries.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries; + } else { + throw new TypeError( + "The summaries must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("tags" in values && values.tags != null) { + if ( + Array.isArray(values.tags) && + values.tags.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags; + } else { + throw new TypeError( + "The tags must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("updated" in values && values.updated != null) { + if (values.updated instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated]; + } else { + throw new TypeError( + "The updated must be of type " + + "Temporal.Instant" + ".", + ); + } + } + + if ("url" in values && values.url != null) { + if (values.url instanceof URL || values.url instanceof Link) { + // @ts-ignore: type is checked above. + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url]; + } else { + throw new TypeError( + "The url must be of type " + + "URL | Link" + ".", + ); + } + } + + if ("urls" in values && values.urls != null) { + if ( + "url" in values && + values.url != null + ) { + throw new TypeError( + "Cannot initialize both url and " + + "urls at the same time.", + ); + } + + if ( + Array.isArray(values.urls) && + values.urls.every((v) => v instanceof URL || v instanceof Link) + ) { + // @ts-ignore: type is checked above. + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls; + } else { + throw new TypeError( + "The urls must be an array of type " + + "URL | Link" + ".", + ); + } + } + + if ("to" in values && values.to != null) { + if (values.to instanceof Object || values.to instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; + } else { + throw new TypeError( + "The to must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("tos" in values && values.tos != null) { + if ( + "to" in values && + values.to != null + ) { + throw new TypeError( + "Cannot initialize both to and " + + "tos at the same time.", + ); + } + + if ( + Array.isArray(values.tos) && + values.tos.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos; + } else { + throw new TypeError( + "The tos must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("bto" in values && values.bto != null) { + if (values.bto instanceof Object || values.bto instanceof URL) { + // @ts-ignore: type is checked above. + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; + } else { + throw new TypeError( + "The bto must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("btos" in values && values.btos != null) { + if ( + "bto" in values && + values.bto != null + ) { + throw new TypeError( + "Cannot initialize both bto and " + + "btos at the same time.", + ); + } + + if ( + Array.isArray(values.btos) && + values.btos.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos; + } else { + throw new TypeError( + "The btos must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("cc" in values && values.cc != null) { + if (values.cc instanceof Object || values.cc instanceof URL) { + // @ts-ignore: type is checked above. + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; + } else { + throw new TypeError( + "The cc must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("ccs" in values && values.ccs != null) { + if ( + "cc" in values && + values.cc != null + ) { + throw new TypeError( + "Cannot initialize both cc and " + + "ccs at the same time.", + ); + } + + if ( + Array.isArray(values.ccs) && + values.ccs.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs; + } else { + throw new TypeError( + "The ccs must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("bcc" in values && values.bcc != null) { + if (values.bcc instanceof Object || values.bcc instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; + } else { + throw new TypeError( + "The bcc must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("bccs" in values && values.bccs != null) { + if ( + "bcc" in values && + values.bcc != null + ) { + throw new TypeError( + "Cannot initialize both bcc and " + + "bccs at the same time.", + ); + } + + if ( + Array.isArray(values.bccs) && + values.bccs.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs; + } else { + throw new TypeError( + "The bccs must be an array of type " + + "Object | URL" + ".", + ); + } + } + + if ("mediaType" in values && values.mediaType != null) { + if (typeof values.mediaType === "string") { + // @ts-ignore: type is checked above. + this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType]; + } else { + throw new TypeError( + "The mediaType must be of type " + + "string" + ".", + ); + } + } + + if ("duration" in values && values.duration != null) { + if (values.duration instanceof Temporal.Duration) { + // @ts-ignore: type is checked above. + this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration]; + } else { + throw new TypeError( + "The duration must be of type " + + "Temporal.Duration" + ".", + ); + } + } + + if ("sensitive" in values && values.sensitive != null) { + if (typeof values.sensitive === "boolean") { + // @ts-ignore: type is checked above. + this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive]; + } else { + throw new TypeError( + "The sensitive must be of type " + + "boolean" + ".", + ); + } + } + + if ("source" in values && values.source != null) { + if (values.source instanceof Source) { + // @ts-ignore: type is checked above. + this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = [values.source]; + } else { + throw new TypeError( + "The source must be of type " + + "Source" + ".", + ); + } + } + + if ("proof" in values && values.proof != null) { + if ( + values.proof instanceof DataIntegrityProof || + values.proof instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; + } else { + throw new TypeError( + "The proof must be of type " + + "DataIntegrityProof | URL" + ".", + ); + } + } + + if ("proofs" in values && values.proofs != null) { + if ( + "proof" in values && + values.proof != null + ) { + throw new TypeError( + "Cannot initialize both proof and " + + "proofs at the same time.", + ); + } + + if ( + Array.isArray(values.proofs) && + values.proofs.every((v) => + v instanceof DataIntegrityProof || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs; + } else { + throw new TypeError( + "The proofs must be an array of type " + + "DataIntegrityProof | URL" + ".", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @options The options to use for cloning. + * @returns The cloned instance. + */ + 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)[]; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, + ): Object { + 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: Object = new this.constructor( + { id: values.id ?? this.id }, + options, + ); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = + this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; + if ("attachments" in values && values.attachments != null) { + if ( + Array.isArray(values.attachments) && + values.attachments.every((v) => + v instanceof Object || v instanceof Link || + v instanceof PropertyValue || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments; + } else { + throw new TypeError( + "The attachments must be an array of type " + + "Object | Link | PropertyValue | URL" + ".", + ); + } + } + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + if ("attribution" in values && values.attribution != null) { + if ( + values.attribution instanceof Application || + values.attribution instanceof Group || + values.attribution instanceof Organization || + values.attribution instanceof Person || + values.attribution instanceof Service || + values.attribution instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [ + values.attribution, + ]; + } else { + throw new TypeError( + "The attribution must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("attributions" in values && values.attributions != null) { + if ( + "attribution" in values && + values.attribution != null + ) { + throw new TypeError( + "Cannot update both attribution and " + + "attributions at the same time.", + ); + } + + if ( + Array.isArray(values.attributions) && + values.attributions.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.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions; + } else { + throw new TypeError( + "The attributions must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + if ("audience" in values && values.audience != null) { + if (values.audience instanceof Object || values.audience instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; + } else { + throw new TypeError( + "The audience must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("audiences" in values && values.audiences != null) { + if ( + "audience" in values && + values.audience != null + ) { + throw new TypeError( + "Cannot update both audience and " + + "audiences at the same time.", + ); + } + + if ( + Array.isArray(values.audiences) && + values.audiences.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences; + } else { + throw new TypeError( + "The audiences must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; + if ("content" in values && values.content != null) { + if ( + typeof values.content === "string" || + values.content instanceof LanguageString + ) { + // @ts-ignore: type is checked above. + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = [values.content]; + } else { + throw new TypeError( + "The content must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("contents" in values && values.contents != null) { + if ( + "content" in values && + values.content != null + ) { + throw new TypeError( + "Cannot update both content and " + + "contents at the same time.", + ); + } + + if ( + Array.isArray(values.contents) && + values.contents.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents; + } else { + throw new TypeError( + "The contents must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = + this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; + if ("contexts" in values && values.contexts != null) { + if ( + Array.isArray(values.contexts) && + values.contexts.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts; + } else { + throw new TypeError( + "The contexts must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + 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" + ".", + ); + } + } + + if ("names" in values && values.names != null) { + if ( + "name" in values && + values.name != null + ) { + throw new TypeError( + "Cannot update both name and " + + "names at the same time.", + ); + } + + if ( + Array.isArray(values.names) && + values.names.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names; + } else { + throw new TypeError( + "The names must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = + this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; + if ("endTime" in values && values.endTime != null) { + if (values.endTime instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime]; + } else { + throw new TypeError( + "The endTime must be of type " + + "Temporal.Instant" + ".", + ); + } + } + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = + this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; + if ("generators" in values && values.generators != null) { + if ( + Array.isArray(values.generators) && + values.generators.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators; + } else { + throw new TypeError( + "The generators must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + if ("icon" in values && values.icon != null) { + if (values.icon instanceof Image || values.icon instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; + } else { + throw new TypeError( + "The icon must be of type " + + "Image | URL" + ".", + ); + } + } + + if ("icons" in values && values.icons != null) { + if ( + "icon" in values && + values.icon != null + ) { + throw new TypeError( + "Cannot update both icon and " + + "icons at the same time.", + ); + } + + if ( + Array.isArray(values.icons) && + values.icons.every((v) => v instanceof Image || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons; + } else { + throw new TypeError( + "The icons must be an array of type " + + "Image | URL" + ".", + ); + } + } + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + if ("image" in values && values.image != null) { + if (values.image instanceof Image || values.image instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; + } else { + throw new TypeError( + "The image must be of type " + + "Image | URL" + ".", + ); + } + } + + if ("images" in values && values.images != null) { + if ( + "image" in values && + values.image != null + ) { + throw new TypeError( + "Cannot update both image and " + + "images at the same time.", + ); + } + + if ( + Array.isArray(values.images) && + values.images.every((v) => v instanceof Image || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images; + } else { + throw new TypeError( + "The images must be an array of type " + + "Image | URL" + ".", + ); + } + } + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + if ("replyTarget" in values && values.replyTarget != null) { + if ( + values.replyTarget instanceof Object || + values.replyTarget instanceof Link || values.replyTarget instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; + } else { + throw new TypeError( + "The replyTarget must be of type " + + "Object | Link | URL" + ".", + ); + } + } + + if ("replyTargets" in values && values.replyTargets != null) { + if ( + "replyTarget" in values && + values.replyTarget != null + ) { + throw new TypeError( + "Cannot update both replyTarget and " + + "replyTargets at the same time.", + ); + } + + if ( + Array.isArray(values.replyTargets) && + values.replyTargets.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets; + } else { + throw new TypeError( + "The replyTargets must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + if ("location" in values && values.location != null) { + if ( + values.location instanceof Object || values.location instanceof Link || + values.location instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; + } else { + throw new TypeError( + "The location must be of type " + + "Object | Link | URL" + ".", + ); } + } - /** - * Clones this instance, optionally updating it with the given values. - * @param values The values to update the clone with. - * @options The options to use for cloning. - * @returns The cloned instance. - */ - 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)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} - ): Object { - 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 }; + if ("locations" in values && values.locations != null) { + if ( + "location" in values && + values.location != null + ) { + throw new TypeError( + "Cannot update both location and " + + "locations at the same time.", + ); + } + + if ( + Array.isArray(values.locations) && + values.locations.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations; + } else { + throw new TypeError( + "The locations must be an array of type " + + "Object | Link | URL" + ".", + ); + } } - - // @ts-ignore: this.constructor is not recognized as a constructor, but it is. - const clone: Object = new this.constructor( - { id: values.id ?? this.id }, - options - ); - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; - if ("attachments" in values && values.attachments != null) { - - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments; - } else { - throw new TypeError( - "The attachments must be an array of type " + - "Object | Link | PropertyValue | URL" + ".", - ); - } - } - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; - if ("attribution" in values && values.attribution != null) { - if (values.attribution instanceof Application || values.attribution instanceof Group || values.attribution instanceof Organization || values.attribution instanceof Person || values.attribution instanceof Service || values.attribution instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [values.attribution]; - } else { - throw new TypeError( - "The attribution must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("attributions" in values && values.attributions != null) { - - if ("attribution" in values && - values.attribution != null) { - throw new TypeError( - "Cannot update both attribution and " + - "attributions at the same time.", - ); - } - - if (Array.isArray(values.attributions) && - values.attributions.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.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions; - } else { - throw new TypeError( - "The attributions must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; - if ("audience" in values && values.audience != null) { - if (values.audience instanceof Object || values.audience instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; - } else { - throw new TypeError( - "The audience must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("audiences" in values && values.audiences != null) { - - if ("audience" in values && - values.audience != null) { - throw new TypeError( - "Cannot update both audience and " + - "audiences at the same time.", - ); - } - - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences; - } else { - throw new TypeError( - "The audiences must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; - if ("content" in values && values.content != null) { - if (typeof values.content === "string" || values.content instanceof LanguageString) { - // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = [values.content]; - } else { - throw new TypeError( - "The content must be of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("contents" in values && values.contents != null) { - - if ("content" in values && - values.content != null) { - throw new TypeError( - "Cannot update both content and " + - "contents at the same time.", - ); - } - - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents; - } else { - throw new TypeError( - "The contents must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; - if ("contexts" in values && values.contexts != null) { - - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts; - } else { - throw new TypeError( - "The contexts must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - 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" + ".", - ); - } - } - - if ("names" in values && values.names != null) { - - if ("name" in values && - values.name != null) { - throw new TypeError( - "Cannot update both name and " + - "names at the same time.", - ); - } - - if (Array.isArray(values.names) && - values.names.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names; - } else { - throw new TypeError( - "The names must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; - if ("endTime" in values && values.endTime != null) { - if (values.endTime instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime]; - } else { - throw new TypeError( - "The endTime must be of type " + - "Temporal.Instant" + ".", - ); - } - } - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; - if ("generators" in values && values.generators != null) { - - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators; - } else { - throw new TypeError( - "The generators must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; - if ("icon" in values && values.icon != null) { - if (values.icon instanceof Image || values.icon instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; - } else { - throw new TypeError( - "The icon must be of type " + - "Image | URL" + ".", - ); - } - } - - if ("icons" in values && values.icons != null) { - - if ("icon" in values && - values.icon != null) { - throw new TypeError( - "Cannot update both icon and " + - "icons at the same time.", - ); - } - - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons; - } else { - throw new TypeError( - "The icons must be an array of type " + - "Image | URL" + ".", - ); - } - } - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; - if ("image" in values && values.image != null) { - if (values.image instanceof Image || values.image instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; - } else { - throw new TypeError( - "The image must be of type " + - "Image | URL" + ".", - ); - } - } - - if ("images" in values && values.images != null) { - - if ("image" in values && - values.image != null) { - throw new TypeError( - "Cannot update both image and " + - "images at the same time.", - ); - } - - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images; - } else { - throw new TypeError( - "The images must be an array of type " + - "Image | URL" + ".", - ); - } - } - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; - if ("replyTarget" in values && values.replyTarget != null) { - if (values.replyTarget instanceof Object || values.replyTarget instanceof Link || values.replyTarget instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; - } else { - throw new TypeError( - "The replyTarget must be of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("replyTargets" in values && values.replyTargets != null) { - - if ("replyTarget" in values && - values.replyTarget != null) { - throw new TypeError( - "Cannot update both replyTarget and " + - "replyTargets at the same time.", - ); - } - - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets; - } else { - throw new TypeError( - "The replyTargets must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; - if ("location" in values && values.location != null) { - if (values.location instanceof Object || values.location instanceof Link || values.location instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; - } else { - throw new TypeError( - "The location must be of type " + - "Object | Link | URL" + ".", - ); - } - } - - if ("locations" in values && values.locations != null) { - - if ("location" in values && - values.location != null) { - throw new TypeError( - "Cannot update both location and " + - "locations at the same time.", - ); - } - - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations; - } else { - throw new TypeError( - "The locations must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; - if ("preview" in values && values.preview != null) { - if (values.preview instanceof Link || values.preview instanceof Object || values.preview instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; - } else { - throw new TypeError( - "The preview must be of type " + - "Link | Object | URL" + ".", - ); - } - } - - if ("previews" in values && values.previews != null) { - - if ("preview" in values && - values.preview != null) { - throw new TypeError( - "Cannot update both preview and " + - "previews at the same time.", - ); - } - - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews; - } else { - throw new TypeError( - "The previews must be an array of type " + - "Link | Object | URL" + ".", - ); - } - } - clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published; - if ("published" in values && values.published != null) { - if (values.published instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published]; - } else { - throw new TypeError( - "The published must be of type " + - "Temporal.Instant" + ".", - ); - } - } - clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies; - if ("replies" in values && values.replies != null) { - if (values.replies instanceof Collection || values.replies instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; - } else { - throw new TypeError( - "The replies must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares; - if ("shares" in values && values.shares != null) { - if (values.shares instanceof Collection || values.shares instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; - } else { - throw new TypeError( - "The shares must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; - if ("likes" in values && values.likes != null) { - if (values.likes instanceof Collection || values.likes instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; - } else { - throw new TypeError( - "The likes must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; - if ("emojiReactions" in values && values.emojiReactions != null) { - if (values.emojiReactions instanceof Collection || values.emojiReactions instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions]; - } else { - throw new TypeError( - "The emojiReactions must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime; - if ("startTime" in values && values.startTime != null) { - if (values.startTime instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime]; - } else { - throw new TypeError( - "The startTime must be of type " + - "Temporal.Instant" + ".", - ); - } - } - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; - if ("summary" in values && values.summary != null) { - if (typeof values.summary === "string" || values.summary instanceof LanguageString) { - // @ts-ignore: type is checked above. - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary]; - } else { - throw new TypeError( - "The summary must be of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("summaries" in values && values.summaries != null) { - - if ("summary" in values && - values.summary != null) { - throw new TypeError( - "Cannot update both summary and " + - "summaries at the same time.", - ); - } - - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries; - } else { - throw new TypeError( - "The summaries must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; - if ("tags" in values && values.tags != null) { - - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags; - } else { - throw new TypeError( - "The tags must be an array of type " + - "Object | Link | URL" + ".", - ); - } - } - clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated; - if ("updated" in values && values.updated != null) { - if (values.updated instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated]; - } else { - throw new TypeError( - "The updated must be of type " + - "Temporal.Instant" + ".", - ); - } - } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; - if ("url" in values && values.url != null) { - if (values.url instanceof URL || values.url instanceof Link) { - // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url]; - } else { - throw new TypeError( - "The url must be of type " + - "URL | Link" + ".", - ); - } - } - - if ("urls" in values && values.urls != null) { - - if ("url" in values && - values.url != null) { - throw new TypeError( - "Cannot update both url and " + - "urls at the same time.", - ); - } - - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { - // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls; - } else { - throw new TypeError( - "The urls must be an array of type " + - "URL | Link" + ".", - ); - } - } - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; - if ("to" in values && values.to != null) { - if (values.to instanceof Object || values.to instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; - } else { - throw new TypeError( - "The to must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("tos" in values && values.tos != null) { - - if ("to" in values && - values.to != null) { - throw new TypeError( - "Cannot update both to and " + - "tos at the same time.", - ); - } - - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos; - } else { - throw new TypeError( - "The tos must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; - if ("bto" in values && values.bto != null) { - if (values.bto instanceof Object || values.bto instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; - } else { - throw new TypeError( - "The bto must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("btos" in values && values.btos != null) { - - if ("bto" in values && - values.bto != null) { - throw new TypeError( - "Cannot update both bto and " + - "btos at the same time.", - ); - } - - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos; - } else { - throw new TypeError( - "The btos must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; - if ("cc" in values && values.cc != null) { - if (values.cc instanceof Object || values.cc instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; - } else { - throw new TypeError( - "The cc must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("ccs" in values && values.ccs != null) { - - if ("cc" in values && - values.cc != null) { - throw new TypeError( - "Cannot update both cc and " + - "ccs at the same time.", - ); - } - - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs; - } else { - throw new TypeError( - "The ccs must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; - if ("bcc" in values && values.bcc != null) { - if (values.bcc instanceof Object || values.bcc instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; - } else { - throw new TypeError( - "The bcc must be of type " + - "Object | URL" + ".", - ); - } - } - - if ("bccs" in values && values.bccs != null) { - - if ("bcc" in values && - values.bcc != null) { - throw new TypeError( - "Cannot update both bcc and " + - "bccs at the same time.", - ); - } - - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs; - } else { - throw new TypeError( - "The bccs must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; - if ("mediaType" in values && values.mediaType != null) { - if (typeof values.mediaType === "string") { - // @ts-ignore: type is checked above. - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType]; - } else { - throw new TypeError( - "The mediaType must be of type " + - "string" + ".", - ); - } - } - clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration; - if ("duration" in values && values.duration != null) { - if (values.duration instanceof Temporal.Duration) { - // @ts-ignore: type is checked above. - clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration]; - } else { - throw new TypeError( - "The duration must be of type " + - "Temporal.Duration" + ".", - ); - } - } - clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive; - if ("sensitive" in values && values.sensitive != null) { - if (typeof values.sensitive === "boolean") { - // @ts-ignore: type is checked above. - clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive]; - } else { - throw new TypeError( - "The sensitive must be of type " + - "boolean" + ".", - ); - } - } - clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; - if ("source" in values && values.source != null) { - if (values.source instanceof Source) { - // @ts-ignore: type is checked above. - clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = [values.source]; - } else { - throw new TypeError( - "The source must be of type " + - "Source" + ".", - ); - } - } - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; - if ("proof" in values && values.proof != null) { - if (values.proof instanceof DataIntegrityProof || values.proof instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; - } else { - throw new TypeError( - "The proof must be of type " + - "DataIntegrityProof | URL" + ".", - ); - } - } - - if ("proofs" in values && values.proofs != null) { - - if ("proof" in values && - values.proof != null) { - throw new TypeError( - "Cannot update both proof and " + - "proofs at the same time.", - ); - } - - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs; - } else { - throw new TypeError( - "The proofs must be an array of type " + - "DataIntegrityProof | URL" + ".", - ); - } - } - + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + if ("preview" in values && values.preview != null) { + if ( + values.preview instanceof Link || values.preview instanceof Object || + values.preview instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; + } else { + throw new TypeError( + "The preview must be of type " + + "Link | Object | URL" + ".", + ); + } + } + + if ("previews" in values && values.previews != null) { + if ( + "preview" in values && + values.preview != null + ) { + throw new TypeError( + "Cannot update both preview and " + + "previews at the same time.", + ); + } + + if ( + Array.isArray(values.previews) && + values.previews.every((v) => + v instanceof Link || v instanceof Object || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews; + } else { + throw new TypeError( + "The previews must be an array of type " + + "Link | Object | URL" + ".", + ); + } + } + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = + this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published; + if ("published" in values && values.published != null) { + if (values.published instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published]; + } else { + throw new TypeError( + "The published must be of type " + + "Temporal.Instant" + ".", + ); + } + } + clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = + this.#_7UpwM3JWcXhADcscukEehBorf6k_replies; + if ("replies" in values && values.replies != null) { + if ( + values.replies instanceof Collection || values.replies instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; + } else { + throw new TypeError( + "The replies must be of type " + + "Collection | URL" + ".", + ); + } + } + clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = + this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares; + if ("shares" in values && values.shares != null) { + if (values.shares instanceof Collection || values.shares instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; + } else { + throw new TypeError( + "The shares must be of type " + + "Collection | URL" + ".", + ); + } + } + clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = + this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; + if ("likes" in values && values.likes != null) { + if (values.likes instanceof Collection || values.likes instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; + } else { + throw new TypeError( + "The likes must be of type " + + "Collection | URL" + ".", + ); + } + } + clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = + this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; + if ("emojiReactions" in values && values.emojiReactions != null) { + if ( + values.emojiReactions instanceof Collection || + values.emojiReactions instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [ + values.emojiReactions, + ]; + } else { + throw new TypeError( + "The emojiReactions must be of type " + + "Collection | URL" + ".", + ); + } + } + clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = + this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime; + if ("startTime" in values && values.startTime != null) { + if (values.startTime instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime]; + } else { + throw new TypeError( + "The startTime must be of type " + + "Temporal.Instant" + ".", + ); + } + } + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; + if ("summary" in values && values.summary != null) { + if ( + typeof values.summary === "string" || + values.summary instanceof LanguageString + ) { + // @ts-ignore: type is checked above. + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary]; + } else { + throw new TypeError( + "The summary must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("summaries" in values && values.summaries != null) { + if ( + "summary" in values && + values.summary != null + ) { + throw new TypeError( + "Cannot update both summary and " + + "summaries at the same time.", + ); + } + + if ( + Array.isArray(values.summaries) && + values.summaries.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries; + } else { + throw new TypeError( + "The summaries must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = + this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; + if ("tags" in values && values.tags != null) { + if ( + Array.isArray(values.tags) && + values.tags.every((v) => + v instanceof Object || v instanceof Link || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags; + } else { + throw new TypeError( + "The tags must be an array of type " + + "Object | Link | URL" + ".", + ); + } + } + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = + this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated; + if ("updated" in values && values.updated != null) { + if (values.updated instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated]; + } else { + throw new TypeError( + "The updated must be of type " + + "Temporal.Instant" + ".", + ); + } + } + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + if ("url" in values && values.url != null) { + if (values.url instanceof URL || values.url instanceof Link) { + // @ts-ignore: type is checked above. + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url]; + } else { + throw new TypeError( + "The url must be of type " + + "URL | Link" + ".", + ); + } + } + + if ("urls" in values && values.urls != null) { + if ( + "url" in values && + values.url != null + ) { + throw new TypeError( + "Cannot update both url and " + + "urls at the same time.", + ); + } + + if ( + Array.isArray(values.urls) && + values.urls.every((v) => v instanceof URL || v instanceof Link) + ) { + // @ts-ignore: type is checked above. + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls; + } else { + throw new TypeError( + "The urls must be an array of type " + + "URL | Link" + ".", + ); + } + } + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + if ("to" in values && values.to != null) { + if (values.to instanceof Object || values.to instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; + } else { + throw new TypeError( + "The to must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("tos" in values && values.tos != null) { + if ( + "to" in values && + values.to != null + ) { + throw new TypeError( + "Cannot update both to and " + + "tos at the same time.", + ); + } + + if ( + Array.isArray(values.tos) && + values.tos.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos; + } else { + throw new TypeError( + "The tos must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + if ("bto" in values && values.bto != null) { + if (values.bto instanceof Object || values.bto instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; + } else { + throw new TypeError( + "The bto must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("btos" in values && values.btos != null) { + if ( + "bto" in values && + values.bto != null + ) { + throw new TypeError( + "Cannot update both bto and " + + "btos at the same time.", + ); + } + + if ( + Array.isArray(values.btos) && + values.btos.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos; + } else { + throw new TypeError( + "The btos must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + if ("cc" in values && values.cc != null) { + if (values.cc instanceof Object || values.cc instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; + } else { + throw new TypeError( + "The cc must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("ccs" in values && values.ccs != null) { + if ( + "cc" in values && + values.cc != null + ) { + throw new TypeError( + "Cannot update both cc and " + + "ccs at the same time.", + ); + } + + if ( + Array.isArray(values.ccs) && + values.ccs.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs; + } else { + throw new TypeError( + "The ccs must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + if ("bcc" in values && values.bcc != null) { + if (values.bcc instanceof Object || values.bcc instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; + } else { + throw new TypeError( + "The bcc must be of type " + + "Object | URL" + ".", + ); + } + } + + if ("bccs" in values && values.bccs != null) { + if ( + "bcc" in values && + values.bcc != null + ) { + throw new TypeError( + "Cannot update both bcc and " + + "bccs at the same time.", + ); + } + + if ( + Array.isArray(values.bccs) && + values.bccs.every((v) => v instanceof Object || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs; + } else { + throw new TypeError( + "The bccs must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = + this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; + if ("mediaType" in values && values.mediaType != null) { + if (typeof values.mediaType === "string") { + // @ts-ignore: type is checked above. + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType]; + } else { + throw new TypeError( + "The mediaType must be of type " + + "string" + ".", + ); + } + } + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = + this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration; + if ("duration" in values && values.duration != null) { + if (values.duration instanceof Temporal.Duration) { + // @ts-ignore: type is checked above. + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration]; + } else { + throw new TypeError( + "The duration must be of type " + + "Temporal.Duration" + ".", + ); + } + } + clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = + this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive; + if ("sensitive" in values && values.sensitive != null) { + if (typeof values.sensitive === "boolean") { + // @ts-ignore: type is checked above. + clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive]; + } else { + throw new TypeError( + "The sensitive must be of type " + + "boolean" + ".", + ); + } + } + clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = + this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; + if ("source" in values && values.source != null) { + if (values.source instanceof Source) { + // @ts-ignore: type is checked above. + clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = [values.source]; + } else { + throw new TypeError( + "The source must be of type " + + "Source" + ".", + ); + } + } + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + if ("proof" in values && values.proof != null) { + if ( + values.proof instanceof DataIntegrityProof || + values.proof instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; + } else { + throw new TypeError( + "The proof must be of type " + + "DataIntegrityProof | URL" + ".", + ); + } + } + + if ("proofs" in values && values.proofs != null) { + if ( + "proof" in values && + values.proof != null + ) { + throw new TypeError( + "Cannot update both proof and " + + "proofs at the same time.", + ); + } + + if ( + Array.isArray(values.proofs) && + values.proofs.every((v) => + v instanceof DataIntegrityProof || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs; + } else { + throw new TypeError( + "The proofs must be an array of type " + + "DataIntegrityProof | URL" + ".", + ); + } + } + return clone; } - - async #fetchAttachment( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + async #fetchAttachment( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -1728,7 +2072,7 @@ proofs?: (DataIntegrityProof | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -1738,20 +2082,20 @@ proofs?: (DataIntegrityProof | URL)[];} try { const obj = await this.#attachment_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -1763,146 +2107,155 @@ proofs?: (DataIntegrityProof | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #attachment_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await PropertyValue.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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); + } - async #attachment_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await PropertyValue.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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. - * - */ + /** 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, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchAttachment( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#attachment_fromJsonLd(obj, options); - continue; - } - } - - yield v; + async *getAttachments( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchAttachment( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#attachment_fromJsonLd(obj, options); + continue; } } - - async #fetchAttribution( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchAttribution( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -1915,7 +2268,7 @@ proofs?: (DataIntegrityProof | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -1925,20 +2278,20 @@ proofs?: (DataIntegrityProof | URL)[];} try { const obj = await this.#attribution_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -1950,230 +2303,244 @@ proofs?: (DataIntegrityProof | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #attribution_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #attribution_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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 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. - * - */ + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchAttribution(v, options); + if (fetched == null) return null; + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } - async getAttribution( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchAttribution(v, options); - if (fetched == null) return null; - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#attribution_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getAttributions}, - * but returns their `@id`s instead of the objects themselves. - */ - get attributionIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.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. - * - */ + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "attributedTo" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "attributedTo" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#attribution_fromJsonLd(obj, options); + } + } - async* getAttributions( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchAttribution( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "attributedTo" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "attributedTo"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#attribution_fromJsonLd(obj, options); - continue; - } - } - - yield v; + return v; + } + + /** + * Similar to + * {@link Object.getAttributions}, + * but returns their `@id`s instead of the objects themselves. + */ + get attributionIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.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. + */ + + async *getAttributions( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchAttribution( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "attributedTo" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "attributedTo" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#attribution_fromJsonLd(obj, options); + continue; } } - - async #fetchAudience( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchAudience( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -2186,7 +2553,7 @@ proofs?: (DataIntegrityProof | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -2196,20 +2563,20 @@ proofs?: (DataIntegrityProof | URL)[];} try { const obj = await this.#audience_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -2221,221 +2588,223 @@ proofs?: (DataIntegrityProof | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #audience_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #audience_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getAudience( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchAudience(v, options); - if (fetched == null) return null; - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#audience_fromJsonLd(obj, options); - } - } - - 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. - * - */ + /** + * 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; + } - async* getAudiences( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchAudience( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#audience_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } + /** 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchAudience(v, options); + if (fetched == null) return null; + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#audience_fromJsonLd(obj, options); } - -/** 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 - ); + } + + 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; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchAudience( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#audience_fromJsonLd(obj, options); + continue; } - 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, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + } + + 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; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -2448,7 +2817,7 @@ get contents(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -2458,20 +2827,20 @@ get contents(): ((string | LanguageString))[] { try { const obj = await this.#context_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -2483,183 +2852,188 @@ get contents(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #context_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getContexts}, + * but returns their `@id`s instead of the objects themselves. + */ + get contextIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + return this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } - async #context_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getContexts}, - * but returns their `@id`s instead of the objects themselves. - */ - get contextIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies the context within which the object exists or an activity was - * performed. - * - * The notion of "context" used is intentionally vague. The intended function - * is to serve as a means of grouping objects and activities that share - * a common originating context or purpose. An example could be all activities - * relating to a common project or event. - * - */ + /** Identifies the context within which the object exists or an activity was + * performed. + * + * The notion of "context" used is intentionally vague. The intended function + * is to serve as a means of grouping objects and activities that share + * a common originating context or purpose. An example could be all activities + * relating to a common project or event. + */ - async* getContexts( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchContext( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "context" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "context"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#context_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } + async *getContexts( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchContext( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** A simple, human-readable, plain-text name for the object. HTML markup MUST - * NOT be included. The name MAY be expressed using multiple language-tagged - * values. - * - */ - 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]; - } - -/** A simple, human-readable, plain-text name for the object. HTML markup MUST - * NOT be included. The name MAY be expressed using multiple language-tagged - * values. - * - */ -get names(): ((string | LanguageString))[] { - return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - } - -/** The date and time describing the actual or expected ending time of - * the object. When used with an {@link Activity} object, for instance, - * the `endTime`` property specifies the moment the activity concluded - * or is expected to conclude. - * - */ - get endTime(): (Temporal.Instant | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "context" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "context" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#context_fromJsonLd(obj, options); + continue; } - if (this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length < 1) return null; - return this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime[0]; - } - - async #fetchGenerator( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + } + + yield v; + } + } + + /** A simple, human-readable, plain-text name for the object. HTML markup MUST + * NOT be included. The name MAY be expressed using multiple language-tagged + * values. + */ + 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]; + } + + /** A simple, human-readable, plain-text name for the object. HTML markup MUST + * NOT be included. The name MAY be expressed using multiple language-tagged + * values. + */ + get names(): ((string | LanguageString))[] { + return this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + } + + /** The date and time describing the actual or expected ending time of + * the object. When used with an {@link Activity} object, for instance, + * the `endTime`` property specifies the moment the activity concluded + * or is expected to conclude. + */ + get endTime(): Temporal.Instant | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length < 1) return null; + return this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime[0]; + } + + async #fetchGenerator( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -2672,7 +3046,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -2682,20 +3056,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#generator_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -2707,135 +3081,143 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #generator_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getGenerators}, + * but returns their `@id`s instead of the objects themselves. + */ + get generatorIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + return this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } - async #generator_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getGenerators}, - * but returns their `@id`s instead of the objects themselves. - */ - get generatorIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + /** Identifies the entity (e.g. an application) that generated the object. + */ + + async *getGenerators( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchGenerator( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** Identifies the entity (e.g. an application) that generated the object. - * - */ - async* getGenerators( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchGenerator( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "generator" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "generator"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#generator_fromJsonLd(obj, options); - continue; - } - } - - yield v; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "generator" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "generator" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#generator_fromJsonLd(obj, options); + continue; } } - - async #fetchIcon( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchIcon( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -2848,7 +3230,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -2858,20 +3240,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#icon_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -2883,194 +3265,198 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #icon_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Image.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #icon_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Image.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Image"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getIcon}, - * but returns its `@id` URL instead of the object itself. - */ - get iconId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < 1) return null; - const v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Indicates an entity that describes an icon for this object. - * The image should have an aspect ratio of one (horizontal) to one - * (vertical) and should be suitable for presentation at a small size. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Image"].join(", "), + ); + } - async getIcon( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < 1) return null; - const v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchIcon(v, options); - if (fetched == null) return null; - this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "icon" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "icon"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#icon_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getIcons}, - * but returns their `@id`s instead of the objects themselves. - */ - get iconIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Indicates an entity that describes an icon for this object. - * The image should have an aspect ratio of one (horizontal) to one - * (vertical) and should be suitable for presentation at a small size. - * - */ + /** + * Similar to + * {@link Object.getIcon}, + * but returns its `@id` URL instead of the object itself. + */ + get iconId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < 1) return null; + const v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; + if (v instanceof URL) return v; + return v.id; + } - async* getIcons( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchIcon( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "icon" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "icon"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#icon_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** Indicates an entity that describes an icon for this object. + * The image should have an aspect ratio of one (horizontal) to one + * (vertical) and should be suitable for presentation at a small size. + */ + + async getIcon( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < 1) return null; + const v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; + if (v instanceof URL) { + const fetched = await this.#fetchIcon(v, options); + if (fetched == null) return null; + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "icon" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "icon" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#icon_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Object.getIcons}, + * but returns their `@id`s instead of the objects themselves. + */ + get iconIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Indicates an entity that describes an icon for this object. + * The image should have an aspect ratio of one (horizontal) to one + * (vertical) and should be suitable for presentation at a small size. + */ + + async *getIcons( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchIcon( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "icon" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "icon" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#icon_fromJsonLd(obj, options); + continue; } } - - async #fetchImage( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchImage( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -3083,7 +3469,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -3093,20 +3479,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#image_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -3118,194 +3504,198 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #image_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Image.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #image_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Image.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Image"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getImage}, - * but returns its `@id` URL instead of the object itself. - */ - get imageId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < 1) return null; - const v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Indicates an entity that describes an image for this object. - * Unlike the icon property, there are no aspect ratio or display size - * limitations assumed. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Image"].join(", "), + ); + } - async getImage( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < 1) return null; - const v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchImage(v, options); - if (fetched == null) return null; - this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "image" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "image"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#image_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getImages}, - * but returns their `@id`s instead of the objects themselves. - */ - get imageIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Indicates an entity that describes an image for this object. - * Unlike the icon property, there are no aspect ratio or display size - * limitations assumed. - * - */ + /** + * Similar to + * {@link Object.getImage}, + * but returns its `@id` URL instead of the object itself. + */ + get imageId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < 1) return null; + const v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; + if (v instanceof URL) return v; + return v.id; + } - async* getImages( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchImage( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "image" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "image"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#image_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** Indicates an entity that describes an image for this object. + * Unlike the icon property, there are no aspect ratio or display size + * limitations assumed. + */ + + async getImage( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < 1) return null; + const v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; + if (v instanceof URL) { + const fetched = await this.#fetchImage(v, options); + if (fetched == null) return null; + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "image" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "image" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#image_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Object.getImages}, + * but returns their `@id`s instead of the objects themselves. + */ + get imageIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Indicates an entity that describes an image for this object. + * Unlike the icon property, there are no aspect ratio or display size + * limitations assumed. + */ + + async *getImages( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchImage( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "image" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "image" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#image_fromJsonLd(obj, options); + continue; } } - - async #fetchReplyTarget( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchReplyTarget( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -3318,7 +3708,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -3328,20 +3718,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#replyTarget_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -3353,201 +3743,208 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #replyTarget_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getReplyTarget}, + * but returns its `@id` URL instead of the object itself. + */ + get replyTargetId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < 1) return null; + const v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Indicates one or more entities for which this object is considered + * a response. + */ + + async getReplyTarget( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < 1) return null; + const v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; + if (v instanceof URL) { + const fetched = await this.#fetchReplyTarget(v, options); + if (fetched == null) return null; + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "inReplyTo" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "inReplyTo" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#replyTarget_fromJsonLd(obj, options); + } } - async #replyTarget_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getReplyTarget}, - * but returns its `@id` URL instead of the object itself. - */ - get replyTargetId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < 1) return null; - const v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Indicates one or more entities for which this object is considered - * a response. - * - */ + return v; + } - async getReplyTarget( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < 1) return null; - const v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchReplyTarget(v, options); - if (fetched == null) return null; - this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "inReplyTo" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "inReplyTo"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#replyTarget_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getReplyTargets}, - * but returns their `@id`s instead of the objects themselves. - */ - get replyTargetIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Indicates one or more entities for which this object is considered - * a response. - * - */ + /** + * Similar to + * {@link Object.getReplyTargets}, + * but returns their `@id`s instead of the objects themselves. + */ + get replyTargetIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } - async* getReplyTargets( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchReplyTarget( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "inReplyTo" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "inReplyTo"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#replyTarget_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** Indicates one or more entities for which this object is considered + * a response. + */ + + async *getReplyTargets( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchReplyTarget( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "inReplyTo" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "inReplyTo" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#replyTarget_fromJsonLd(obj, options); + continue; } } - - async #fetchLocation( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchLocation( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -3560,7 +3957,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -3570,20 +3967,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#location_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -3595,201 +3992,208 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #location_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getLocation}, + * but returns its `@id` URL instead of the object itself. + */ + get locationId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + if (this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < 1) return null; + const v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; + if (v instanceof URL) return v; + return v.id; + } - async #location_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getLocation}, - * but returns its `@id` URL instead of the object itself. - */ - get locationId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < 1) return null; - const v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Indicates one or more physical or logical locations associated with - * the object. - * - */ + /** Indicates one or more physical or logical locations associated with + * the object. + */ - async getLocation( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < 1) return null; - const v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchLocation(v, options); - if (fetched == null) return null; - this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "location" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "location"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#location_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getLocations}, - * but returns their `@id`s instead of the objects themselves. - */ - get locationIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Indicates one or more physical or logical locations associated with - * the object. - * - */ + async getLocation( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < 1) return null; + const v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; + if (v instanceof URL) { + const fetched = await this.#fetchLocation(v, options); + if (fetched == null) return null; + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } - async* getLocations( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchLocation( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "location" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "location"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#location_fromJsonLd(obj, options); - continue; - } - } - - yield v; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "location" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "location" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#location_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Object.getLocations}, + * but returns their `@id`s instead of the objects themselves. + */ + get locationIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Indicates one or more physical or logical locations associated with + * the object. + */ + + async *getLocations( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchLocation( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "location" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "location" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#location_fromJsonLd(obj, options); + continue; } } - - async #fetchPreview( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchPreview( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -3802,7 +4206,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -3812,20 +4216,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#preview_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -3837,212 +4241,219 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #preview_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError( + "Expected an object of any type of: " + + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Object", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getPreview}, + * but returns its `@id` URL instead of the object itself. + */ + get previewId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + if (this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < 1) return null; + const v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; + if (v instanceof URL) return v; + return v.id; + } - async #preview_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Object"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getPreview}, - * but returns its `@id` URL instead of the object itself. - */ - get previewId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < 1) return null; - const v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies an entity that provides a preview of this object. - * - */ + /** Identifies an entity that provides a preview of this object. + */ - async getPreview( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < 1) return null; - const v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchPreview(v, options); - if (fetched == null) return null; - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "preview" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "preview"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#preview_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getPreviews}, - * but returns their `@id`s instead of the objects themselves. - */ - get previewIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + async getPreview( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < 1) return null; + const v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; + if (v instanceof URL) { + const fetched = await this.#fetchPreview(v, options); + if (fetched == null) return null; + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "preview" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "preview" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#preview_fromJsonLd(obj, options); } - -/** Identifies an entity that provides a preview of this object. - * - */ + } - async* getPreviews( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchPreview( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "preview" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "preview"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#preview_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } + return v; + } + + /** + * Similar to + * {@link Object.getPreviews}, + * but returns their `@id`s instead of the objects themselves. + */ + get previewIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Identifies an entity that provides a preview of this object. + */ + + async *getPreviews( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchPreview( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** The date and time at which the object was published. - */ - get published(): (Temporal.Instant | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "preview" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "preview" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#preview_fromJsonLd(obj, options); + continue; } - if (this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length < 1) return null; - return this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published[0]; - } - - async #fetchReplies( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + } + + yield v; + } + } + + /** The date and time at which the object was published. + */ + get published(): Temporal.Instant | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length < 1) return null; + return this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published[0]; + } + + async #fetchReplies( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -4055,7 +4466,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -4065,20 +4476,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#replies_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -4090,123 +4501,126 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #replies_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #replies_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getReplies}, - * but returns its `@id` URL instead of the object itself. - */ - get repliesId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < 1) return null; - const v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies a {@link Collection} containing objects considered to be - * responses to this object. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getReplies( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < 1) return null; - const v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchReplies(v, options); - if (fetched == null) return null; - this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "replies" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "replies"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#replies_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchShares( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Object.getReplies}, + * but returns its `@id` URL instead of the object itself. + */ + get repliesId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < 1) return null; + const v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Identifies a {@link Collection} containing objects considered to be + * responses to this object. + */ + + async getReplies( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < 1) return null; + const v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; + if (v instanceof URL) { + const fetched = await this.#fetchReplies(v, options); + if (fetched == null) return null; + this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "replies" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "replies" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#replies_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchShares( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -4219,7 +4633,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -4229,20 +4643,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#shares_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -4254,129 +4668,132 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #shares_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #shares_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getShares}, - * but returns its `@id` URL instead of the object itself. - */ - get sharesId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < 1) return null; - const v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Every object *may* have a `shares` collection. This is a list of all - * {@link Announce} activities with this object as the `object` property, - * added as a [side effect]. The `shares` collection *must* be either - * an {@link OrderedCollection} or a {@link Collection} and *may* be filtered - * on privileges of an authenticated user or as appropriate - * when no authentication is given. - * - * [side effect]: https://www.w3.org/TR/activitypub/#announce-activity-inbox - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getShares( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < 1) return null; - const v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchShares(v, options); - if (fetched == null) return null; - this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "shares" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "shares"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#shares_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchLikes( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Object.getShares}, + * but returns its `@id` URL instead of the object itself. + */ + get sharesId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < 1) return null; + const v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Every object *may* have a `shares` collection. This is a list of all + * {@link Announce} activities with this object as the `object` property, + * added as a [side effect]. The `shares` collection *must* be either + * an {@link OrderedCollection} or a {@link Collection} and *may* be filtered + * on privileges of an authenticated user or as appropriate + * when no authentication is given. + * + * [side effect]: https://www.w3.org/TR/activitypub/#announce-activity-inbox + */ + + async getShares( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < 1) return null; + const v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; + if (v instanceof URL) { + const fetched = await this.#fetchShares(v, options); + if (fetched == null) return null; + this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "shares" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "shares" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#shares_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchLikes( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -4389,7 +4806,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -4399,20 +4816,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#likes_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -4424,129 +4841,132 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #likes_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #likes_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getLikes}, - * but returns its `@id` URL instead of the object itself. - */ - get likesId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < 1) return null; - const v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Every object *may* have a `likes` collection. This is a list of all - * {@link Like} activities with this object as the `object` property, - * added as a [side effect]. The `likes` collection *must* be either - * an {@link OrderedCollection} or a {@link Collection} and *may* be filtered - * on privileges of an authenticated user or as appropriate - * when no authentication is given. - * - * [side effect]: https://www.w3.org/TR/activitypub/#announce-activity-inbox - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getLikes( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < 1) return null; - const v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchLikes(v, options); - if (fetched == null) return null; - this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "likes" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "likes"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#likes_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchEmojiReactions( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Object.getLikes}, + * but returns its `@id` URL instead of the object itself. + */ + get likesId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < 1) return null; + const v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Every object *may* have a `likes` collection. This is a list of all + * {@link Like} activities with this object as the `object` property, + * added as a [side effect]. The `likes` collection *must* be either + * an {@link OrderedCollection} or a {@link Collection} and *may* be filtered + * on privileges of an authenticated user or as appropriate + * when no authentication is given. + * + * [side effect]: https://www.w3.org/TR/activitypub/#announce-activity-inbox + */ + + async getLikes( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < 1) return null; + const v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; + if (v instanceof URL) { + const fetched = await this.#fetchLikes(v, options); + if (fetched == null) return null; + this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "likes" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "likes" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#likes_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchEmojiReactions( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -4559,7 +4979,7 @@ get names(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -4569,20 +4989,20 @@ get names(): ((string | LanguageString))[] { try { const obj = await this.#emojiReactions_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -4594,163 +5014,167 @@ get names(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #emojiReactions_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #emojiReactions_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getEmojiReactions}, - * but returns its `@id` URL instead of the object itself. - */ - get emojiReactionsId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < 1) return null; - const v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies a {@link Collection} containing objects considered to be - * emoji reactions to this object. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getEmojiReactions( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < 1) return null; - const v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchEmojiReactions(v, options); - if (fetched == null) return null; - this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "emojiReactions" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "emojiReactions"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#emojiReactions_fromJsonLd(obj, options); - } - } - - return v; - } - -/** The date and time describing the actual or expected starting time of - * the object. When used with an {@link Activity} object, for instance, - * the `startTime` property specifies the moment the activity began or - * is scheduled to begin. - * - */ - get startTime(): (Temporal.Instant | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length < 1) return null; - return this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime[0]; - } - -/** A natural language summarization of the object encoded as HTML. - * Multiple language tagged summaries MAY be provided. - * - */ - get summary(): (string | LanguageString | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length < 1) return null; - return this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary[0]; + /** + * Similar to + * {@link Object.getEmojiReactions}, + * but returns its `@id` URL instead of the object itself. + */ + get emojiReactionsId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < 1) { + return null; + } + const v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Identifies a {@link Collection} containing objects considered to be + * emoji reactions to this object. + */ + + async getEmojiReactions( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < 1) { + return null; + } + const v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; + if (v instanceof URL) { + const fetched = await this.#fetchEmojiReactions(v, options); + if (fetched == null) return null; + this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "emojiReactions" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "emojiReactions" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#emojiReactions_fromJsonLd(obj, options); } - -/** A natural language summarization of the object encoded as HTML. - * Multiple language tagged summaries MAY be provided. - * - */ -get summaries(): ((string | LanguageString))[] { - return this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; - } - - async #fetchTag( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + } + + return v; + } + + /** The date and time describing the actual or expected starting time of + * the object. When used with an {@link Activity} object, for instance, + * the `startTime` property specifies the moment the activity began or + * is scheduled to begin. + */ + get startTime(): Temporal.Instant | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length < 1) return null; + return this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime[0]; + } + + /** A natural language summarization of the object encoded as HTML. + * Multiple language tagged summaries MAY be provided. + */ + get summary(): string | LanguageString | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length < 1) return null; + return this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary[0]; + } + + /** A natural language summarization of the object encoded as HTML. + * Multiple language tagged summaries MAY be provided. + */ + get summaries(): ((string | LanguageString))[] { + return this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; + } + + async #fetchTag( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -4763,7 +5187,7 @@ get summaries(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -4773,20 +5197,20 @@ get summaries(): ((string | LanguageString))[] { try { const obj = await this.#tag_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -4798,172 +5222,178 @@ get summaries(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #tag_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Link.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getTags}, + * but returns their `@id`s instead of the objects themselves. + */ + get tagIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + return this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } - async #tag_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Link.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getTags}, - * but returns their `@id`s instead of the objects themselves. - */ - get tagIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** One or more "tags" that have been associated with an objects. - * A tag can be any kind of Object. The key difference between `attachment` - * and `tag` is that the former implies association by inclusion, - * while the latter implies associated by reference. - * - */ + /** One or more "tags" that have been associated with an objects. + * A tag can be any kind of Object. The key difference between `attachment` + * and `tag` is that the former implies association by inclusion, + * while the latter implies associated by reference. + */ - async* getTags( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchTag( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "tag" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "tag"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#tag_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } - } - -/** The date and time at which the object was updated. - */ - get updated(): (Temporal.Instant | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length < 1) return null; - return this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + async *getTags( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchTag( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** Identifies one or more links to representations of the object. - * - */ - get url(): (URL | Link | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "tag" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "tag" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#tag_fromJsonLd(obj, options); + continue; } - if (this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < 1) return null; - return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; } - -/** Identifies one or more links to representations of the object. - * - */ -get urls(): ((URL | Link))[] { - return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; - } - - async #fetchTo( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + /** The date and time at which the object was updated. + */ + get updated(): Temporal.Instant | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length < 1) return null; + return this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated[0]; + } + + /** Identifies one or more links to representations of the object. + */ + get url(): URL | Link | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < 1) return null; + return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[0]; + } + + /** Identifies one or more links to representations of the object. + */ + get urls(): ((URL | Link))[] { + return this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + } + + async #fetchTo( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -4976,7 +5406,7 @@ get urls(): ((URL | Link))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -4986,20 +5416,20 @@ get urls(): ((URL | Link))[] { try { const obj = await this.#to_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -5011,192 +5441,196 @@ get urls(): ((URL | Link))[] { } finally { span.end(); } - }); + }, + ); + } + + async #to_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #to_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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.getTo}, - * but returns its `@id` URL instead of the object itself. - */ - get toId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < 1) return null; - const v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies an entity considered to be part of the public primary audience - * of an Object. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getTo( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < 1) return null; - const v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchTo(v, options); - if (fetched == null) return null; - this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "to" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "to"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#to_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getTos}, - * but returns their `@id`s instead of the objects themselves. - */ - get toIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies an entity considered to be part of the public primary audience - * of an Object. - * - */ + /** + * Similar to + * {@link Object.getTo}, + * but returns its `@id` URL instead of the object itself. + */ + get toId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < 1) return null; + const v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + if (v instanceof URL) return v; + return v.id; + } - async* getTos( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchTo( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "to" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "to"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#to_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** Identifies an entity considered to be part of the public primary audience + * of an Object. + */ + + async getTo( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < 1) return null; + const v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; + if (v instanceof URL) { + const fetched = await this.#fetchTo(v, options); + if (fetched == null) return null; + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "to" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "to" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#to_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Object.getTos}, + * but returns their `@id`s instead of the objects themselves. + */ + get toIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Identifies an entity considered to be part of the public primary audience + * of an Object. + */ + + async *getTos( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchTo( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "to" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "to" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#to_fromJsonLd(obj, options); + continue; } } - - async #fetchBto( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchBto( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -5209,7 +5643,7 @@ get urls(): ((URL | Link))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -5219,20 +5653,20 @@ get urls(): ((URL | Link))[] { try { const obj = await this.#bto_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -5244,192 +5678,196 @@ get urls(): ((URL | Link))[] { } finally { span.end(); } - }); + }, + ); + } + + async #bto_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #bto_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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.getBto}, - * but returns its `@id` URL instead of the object itself. - */ - get btoId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < 1) return null; - const v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies an Object that is part of the private primary audience of - * this Object. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getBto( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < 1) return null; - const v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchBto(v, options); - if (fetched == null) return null; - this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "bto" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "bto"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#bto_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getBtos}, - * but returns their `@id`s instead of the objects themselves. - */ - get btoIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies an Object that is part of the private primary audience of - * this Object. - * - */ + /** + * Similar to + * {@link Object.getBto}, + * but returns its `@id` URL instead of the object itself. + */ + get btoId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < 1) return null; + const v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; + if (v instanceof URL) return v; + return v.id; + } - async* getBtos( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchBto( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "bto" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "bto"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#bto_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** Identifies an Object that is part of the private primary audience of + * this Object. + */ + + async getBto( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < 1) return null; + const v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; + if (v instanceof URL) { + const fetched = await this.#fetchBto(v, options); + if (fetched == null) return null; + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "bto" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "bto" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#bto_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Object.getBtos}, + * but returns their `@id`s instead of the objects themselves. + */ + get btoIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Identifies an Object that is part of the private primary audience of + * this Object. + */ + + async *getBtos( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchBto( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "bto" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "bto" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#bto_fromJsonLd(obj, options); + continue; } } - - async #fetchCc( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchCc( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -5442,7 +5880,7 @@ get urls(): ((URL | Link))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -5452,20 +5890,20 @@ get urls(): ((URL | Link))[] { try { const obj = await this.#cc_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -5477,192 +5915,196 @@ get urls(): ((URL | Link))[] { } finally { span.end(); } - }); + }, + ); + } + + async #cc_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #cc_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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.getCc}, - * but returns its `@id` URL instead of the object itself. - */ - get ccId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < 1) return null; - const v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies an Object that is part of the public secondary audience of - * this Object. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getCc( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < 1) return null; - const v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchCc(v, options); - if (fetched == null) return null; - this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "cc" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "cc"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#cc_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getCcs}, - * but returns their `@id`s instead of the objects themselves. - */ - get ccIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies an Object that is part of the public secondary audience of - * this Object. - * - */ + /** + * Similar to + * {@link Object.getCc}, + * but returns its `@id` URL instead of the object itself. + */ + get ccId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < 1) return null; + const v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; + if (v instanceof URL) return v; + return v.id; + } - async* getCcs( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchCc( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "cc" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "cc"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#cc_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** Identifies an Object that is part of the public secondary audience of + * this Object. + */ + + async getCc( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < 1) return null; + const v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; + if (v instanceof URL) { + const fetched = await this.#fetchCc(v, options); + if (fetched == null) return null; + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "cc" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "cc" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#cc_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Object.getCcs}, + * but returns their `@id`s instead of the objects themselves. + */ + get ccIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Identifies an Object that is part of the public secondary audience of + * this Object. + */ + + async *getCcs( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchCc( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "cc" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "cc" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#cc_fromJsonLd(obj, options); + continue; } } - - async #fetchBcc( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchBcc( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -5675,7 +6117,7 @@ get urls(): ((URL | Link))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -5685,20 +6127,20 @@ get urls(): ((URL | Link))[] { try { const obj = await this.#bcc_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -5710,256 +6152,257 @@ get urls(): ((URL | Link))[] { } finally { span.end(); } - }); + }, + ); + } + + async #bcc_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #bcc_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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.getBcc}, - * but returns its `@id` URL instead of the object itself. - */ - get bccId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < 1) return null; - const v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Identifies one or more Objects that are part of the private secondary - * audience of this Object. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getBcc( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < 1) return null; - const v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchBcc(v, options); - if (fetched == null) return null; - this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "bcc" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "bcc"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#bcc_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getBccs}, - * but returns their `@id`s instead of the objects themselves. - */ - get bccIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Identifies one or more Objects that are part of the private secondary - * audience of this Object. - * - */ + /** + * Similar to + * {@link Object.getBcc}, + * but returns its `@id` URL instead of the object itself. + */ + get bccId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < 1) return null; + const v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + if (v instanceof URL) return v; + return v.id; + } - async* getBccs( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchBcc( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "bcc" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "bcc"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#bcc_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } + /** Identifies one or more Objects that are part of the private secondary + * audience of this Object. + */ + + async getBcc( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < 1) return null; + const v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; + if (v instanceof URL) { + const fetched = await this.#fetchBcc(v, options); + if (fetched == null) return null; + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "bcc" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "bcc" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#bcc_fromJsonLd(obj, options); } - -/** When used on an {@link Object}, identifies the MIME media type of the value - * of the `content` property. If not specified, the `content` property is - * assumed to contain `text/html` content. - * - */ - get mediaType(): (string | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < 1) return null; - return this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; - } - -/** When the object describes a time-bound resource, such as an audio or video, - * a meeting, etc, the `duration` property indicates the object's approximate - * duration. The value MUST be expressed as an `xsd:duration` as defined by - * W3C XML Schema Definition Language (XSD) 1.1 Part 2: DataTypes, section - * 3.3.6 (e.g. a period of 5 seconds is represented as `PT5S`). - * - */ - get duration(): (Temporal.Duration | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length < 1) return null; - return this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; + } + + return v; + } + + /** + * Similar to + * {@link Object.getBccs}, + * but returns their `@id`s instead of the objects themselves. + */ + get bccIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Identifies one or more Objects that are part of the private secondary + * audience of this Object. + */ + + async *getBccs( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchBcc( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** Whether it contains any sensitive contents. - */ - get sensitive(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length < 1) return null; - return this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; - } - -/** The `source` property is intended to convey some sort of source from which - * the `content` markup was derived, as a form of provenance, or to support - * future editing by clients. In general, clients do the conversion from - * `source` to `content`, not the other way around. - * - */ - get source(): (Source | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "bcc" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "bcc" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#bcc_fromJsonLd(obj, options); + continue; } - if (this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length < 1) return null; - return this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; - } - - async #fetchProof( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + } + + yield v; + } + } + + /** When used on an {@link Object}, identifies the MIME media type of the value + * of the `content` property. If not specified, the `content` property is + * assumed to contain `text/html` content. + */ + get mediaType(): string | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < 1) return null; + return this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType[0]; + } + + /** When the object describes a time-bound resource, such as an audio or video, + * a meeting, etc, the `duration` property indicates the object's approximate + * duration. The value MUST be expressed as an `xsd:duration` as defined by + * W3C XML Schema Definition Language (XSD) 1.1 Part 2: DataTypes, section + * 3.3.6 (e.g. a period of 5 seconds is represented as `PT5S`). + */ + get duration(): Temporal.Duration | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length < 1) return null; + return this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration[0]; + } + + /** Whether it contains any sensitive contents. + */ + get sensitive(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length < 1) return null; + return this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive[0]; + } + + /** The `source` property is intended to convey some sort of source from which + * the `content` markup was derived, as a form of provenance, or to support + * future editing by clients. In general, clients do the conversion from + * `source` to `content`, not the other way around. + */ + get source(): Source | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length < 1) return null; + return this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[0]; + } + + async #fetchProof( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -5972,7 +6415,7 @@ get urls(): ((URL | Link))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -5982,20 +6425,20 @@ get urls(): ((URL | Link))[] { try { const obj = await this.#proof_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -6007,170 +6450,172 @@ get urls(): ((URL | Link))[] { } finally { span.end(); } - }); + }, + ); + } + + async #proof_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await DataIntegrityProof.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError( + "Expected an object of any type of: " + + ["https://w3id.org/security#DataIntegrityProof"].join(", "), + ); + } + + /** + * Similar to + * {@link Object.getProof}, + * but returns its `@id` URL instead of the object itself. + */ + get proofId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < 1) return null; + const v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; + if (v instanceof URL) return v; + return v.id; + } - async #proof_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await DataIntegrityProof.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://w3id.org/security#DataIntegrityProof"].join(", ")); - } - - - /** - * Similar to - * {@link Object.getProof}, - * but returns its `@id` URL instead of the object itself. - */ - get proofId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < 1) return null; - const v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** A cryptographic proof that can be used to verify the integrity of an object. - * - */ + /** A cryptographic proof that can be used to verify the integrity of an object. + */ - async getProof( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < 1) return null; - const v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchProof(v, options); - if (fetched == null) return null; - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "proof" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "proof"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#proof_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Object.getProofs}, - * but returns their `@id`s instead of the objects themselves. - */ - get proofIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + async getProof( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < 1) return null; + const v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; + if (v instanceof URL) { + const fetched = await this.#fetchProof(v, options); + if (fetched == null) return null; + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "proof" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "proof" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#proof_fromJsonLd(obj, options); } - -/** A cryptographic proof that can be used to verify the integrity of an object. - * - */ + } - async* getProofs( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchProof( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "proof" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "proof"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#proof_fromJsonLd(obj, options); - continue; - } - } - - yield v; + return v; + } + + /** + * Similar to + * {@link Object.getProofs}, + * but returns their `@id`s instead of the objects themselves. + */ + get proofIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** A cryptographic proof that can be used to verify the integrity of an object. + */ + + async *getProofs( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchProof( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "proof" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "proof" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#proof_fromJsonLd(obj, options); + continue; } } - + + yield v; + } + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -6181,10 +6626,13 @@ get urls(): ((URL | Link))[] { 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)[], + async toJsonLd(options: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -6192,1189 +6640,982 @@ get urls(): ((URL | Link))[] { 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'." + "to 'compact'.", ); } options = { ...options, contextLoader: options.contextLoader ?? getDocumentLoader(), }; - + if (options.format == null && this.isCompactable()) { - const result: Record = {}; + 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, - }) - ); + 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 + 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, - }) - ); + 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 + 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, - }) - ); + 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 + 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.language.compact(), - } - ); + const item = typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.language.compact(), + }; compactItems.push(item); } if (compactItems.length > 0) { - - result["content"] - = compactItems.length > 1 + 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, - }) - ); + 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 + 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.language.compact(), - } - ); + const item = typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.language.compact(), + }; compactItems.push(item); } if (compactItems.length > 0) { - - result["name"] - = compactItems.length > 1 + result["name"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { - const item = ( - v.toString() - ); + const item = v.toString(); compactItems.push(item); } if (compactItems.length > 0) { - - result["endTime"] - = compactItems.length > 1 + result["endTime"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { - 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, - }) - ); + 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["generator"] - = compactItems.length > 1 + result["generator"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["icon"] - = compactItems.length > 1 + result["icon"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["image"] - = compactItems.length > 1 + result["image"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { - 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, - }) - ); + 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["inReplyTo"] - = compactItems.length > 1 + result["inReplyTo"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { - 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, - }) - ); + 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["location"] - = compactItems.length > 1 + result["location"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { - const item = ( - v instanceof URL ? v.href : v instanceof Link ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL + ? v.href + : 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["preview"] - = compactItems.length > 1 + result["preview"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { - const item = ( - v.toString() - ); + const item = v.toString(); compactItems.push(item); } if (compactItems.length > 0) { - - result["published"] - = compactItems.length > 1 + result["published"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_7UpwM3JWcXhADcscukEehBorf6k_replies) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["replies"] - = compactItems.length > 1 + result["replies"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["shares"] - = compactItems.length > 1 + result["shares"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["likes"] - = compactItems.length > 1 + result["likes"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["emojiReactions"] - = compactItems.length > 1 + result["emojiReactions"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { - const item = ( - v.toString() - ); + const item = v.toString(); compactItems.push(item); } if (compactItems.length > 0) { - - result["startTime"] - = compactItems.length > 1 + result["startTime"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { - const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.language.compact(), - } - ); + const item = typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.language.compact(), + }; compactItems.push(item); } if (compactItems.length > 0) { - - result["summary"] - = compactItems.length > 1 + result["summary"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { - 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, - }) - ); + 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["tag"] - = compactItems.length > 1 + result["tag"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { - const item = ( - v.toString() - ); + const item = v.toString(); compactItems.push(item); } if (compactItems.length > 0) { - - result["updated"] - = compactItems.length > 1 + result["updated"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["url"] - = compactItems.length > 1 + result["url"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["to"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + result["to"] = compactItems.length > 1 ? compactItems : compactItems[0]; } - + compactItems = []; for (const v of this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["bto"] - = compactItems.length > 1 + result["bto"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["cc"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - + result["cc"] = compactItems.length > 1 ? compactItems : compactItems[0]; } - + compactItems = []; for (const v of this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["bcc"] - = compactItems.length > 1 + result["bcc"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["mediaType"] - = compactItems.length > 1 + result["mediaType"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { - const item = ( - v.toString() - ); + const item = v.toString(); compactItems.push(item); } if (compactItems.length > 0) { - - result["duration"] - = compactItems.length > 1 + result["duration"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["sensitive"] - = compactItems.length > 1 + result["sensitive"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { - const item = ( - await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["source"] - = compactItems.length > 1 + result["source"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["proof"] - = compactItems.length > 1 + result["proof"] = 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", + { + "fedibird": "http://fedibird.com/ns#", + "sensitive": "as:sensitive", + "emojiReactions": { + "@id": "fedibird:emojiReactions", + "@type": "@id", + }, + }, + ]; return result; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + const values: Record = {}; array = []; for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Object ? await v.toJsonLd(options) : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Object + ? await v.toJsonLd(options) + : v instanceof Link + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#attachment"] = propValue; - } - + array = []; for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { - 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);; + 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 - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#attributedTo"] = propValue; - } - + array = []; for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#audience"] = propValue; - } - + array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { - const element = ( - typeof v === "string" ? { "@value": v } : { + const element = typeof v === "string" ? { "@value": v } : { "@value": v.toString(), "@language": v.language.compact(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#content"] = propValue; - } - + array = []; for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Object + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#context"] = propValue; - } - + array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { - const element = ( - typeof v === "string" ? { "@value": v } : { + const element = typeof v === "string" ? { "@value": v } : { "@value": v.toString(), "@language": v.language.compact(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#name"] = propValue; - } - + array = []; for (const v of this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", "@value": v.toString(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#endTime"] = propValue; - } - + array = []; for (const v of this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Object + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#generator"] = propValue; - } - + array = []; for (const v of this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#icon"] = propValue; - } - + array = []; for (const v of this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#image"] = propValue; - } - + array = []; for (const v of this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Object + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#inReplyTo"] = propValue; - } - + array = []; for (const v of this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Object + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#location"] = propValue; - } - + array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Link + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#preview"] = propValue; - } - + array = []; for (const v of this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", "@value": v.toString(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#published"] = propValue; - } - + array = []; for (const v of this.#_7UpwM3JWcXhADcscukEehBorf6k_replies) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#replies"] = propValue; - } - + array = []; for (const v of this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#shares"] = propValue; - } - + array = []; for (const v of this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#likes"] = propValue; - } - + array = []; for (const v of this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://fedibird.com/ns#emojiReactions"] = propValue; - } - + array = []; for (const v of this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", "@value": v.toString(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#startTime"] = propValue; - } - + array = []; for (const v of this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { - const element = ( - typeof v === "string" ? { "@value": v } : { + const element = typeof v === "string" ? { "@value": v } : { "@value": v.toString(), "@language": v.language.compact(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#summary"] = propValue; - } - + array = []; for (const v of this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof Object + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#tag"] = propValue; - } - + array = []; for (const v of this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", "@value": v.toString(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#updated"] = propValue; - } - + array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#url"] = propValue; - } - + array = []; for (const v of this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#to"] = propValue; - } - + array = []; for (const v of this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#bto"] = propValue; - } - + array = []; for (const v of this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#cc"] = propValue; - } - + array = []; for (const v of this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#bcc"] = propValue; - } - + array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#mediaType"] = propValue; - } - + array = []; for (const v of this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#duration", "@value": v.toString(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#duration"] = propValue; - } - + array = []; for (const v of this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#sensitive"] = propValue; - } - + array = []; for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { - const element = ( - await v.toJsonLd(options) - ); - array.push(element);; + const element = await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#source"] = propValue; - } - + array = []; for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push({ "@graph": element });; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push({ "@graph": element }); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#proof"] = propValue; - } - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Object"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -7384,7 +7625,18 @@ 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", + { + "fedibird": "http://fedibird.com/ns#", + "sensitive": "as:sensitive", + "emojiReactions": { + "@id": "fedibird:emojiReactions", + "@type": "@id", + }, + }, + ]; const compacted = await jsonld.compact( values, docContext, @@ -7392,1208 +7644,2078 @@ get urls(): ((URL | Link))[] { ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + compacted.proof["@context"] = docContext; + } + } + } + return compacted; + } + + protected isCompactable(): boolean { + if ( + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content != null && + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 0 + ) return false; + + if ( + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 + ) return false; + + if ( + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary != null && + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0 + ) return false; + + if ( + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof != null && + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.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; + } = {}, + ): Promise { + const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); + const tracer = tracerProvider.getTracer( + "@fedify/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.parse_object", + async (span) => { + try { + const object = await this.__fromJsonLd__Object__( + 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__Object__( + json: unknown, + span: Span, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + } = {}, + ): 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 ("@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")) { + return await Emoji.fromJsonLd(json, options); + } + + if (values["@type"].includes("http://litepub.social/ns#ChatMessage")) { + return await ChatMessage.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Activity", + ) + ) { + return await Activity.fromJsonLd(json, options); + } + + 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); + } + + 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#Application", + ) + ) { + return await Application.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Article", + ) + ) { + return await Article.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Collection", + ) + ) { + return await Collection.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#CollectionPage", + ) + ) { + return await CollectionPage.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#OrderedCollectionPage", + ) + ) { + return await OrderedCollectionPage.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#OrderedCollection", + ) + ) { + return await OrderedCollection.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Document", + ) + ) { + return await Document.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Audio") + ) { + return await Audio.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Image") + ) { + return await Image.fromJsonLd(json, options); } - - } - return compacted; - } - protected isCompactable(): boolean { + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Page") + ) { + return await Page.fromJsonLd(json, options); + } if ( - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content != null && - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 0 - ) return false; - + values["@type"].includes("https://www.w3.org/ns/activitystreams#Video") + ) { + return await Video.fromJsonLd(json, options); + } + if ( - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name != null && - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 - ) return false; - + values["@type"].includes("https://www.w3.org/ns/activitystreams#Event") + ) { + return await Event.fromJsonLd(json, options); + } + if ( - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary != null && - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0 - ) return false; - + values["@type"].includes("https://www.w3.org/ns/activitystreams#Group") + ) { + return await Group.fromJsonLd(json, options); + } + if ( - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof != null && - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.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, - } = {}, - ): Promise { - const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); - const tracer = tracerProvider.getTracer( - "@fedify/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan( - "activitypub.parse_object", - async (span) => { - try { - const object = await this.__fromJsonLd__Object__( - 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(); - } - }, - ); - } + values["@type"].includes("https://www.w3.org/ns/activitystreams#Note") + ) { + return await Note.fromJsonLd(json, options); + } - protected static async __fromJsonLd__Object__( - json: unknown, - span: Span, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } = {}, - ): 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 ("@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")) { - return await Emoji.fromJsonLd(json, options); - } - - if (values["@type"].includes("http://litepub.social/ns#ChatMessage")) { - return await ChatMessage.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) { - return await Activity.fromJsonLd(json, options); - } - - 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); - } - - 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#Application")) { - return await Application.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Article")) { - return await Article.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Collection")) { - return await Collection.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#CollectionPage")) { - return await CollectionPage.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollectionPage")) { - return await OrderedCollectionPage.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollection")) { - return await OrderedCollection.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Document")) { - return await Document.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Audio")) { - return await Audio.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Image")) { - return await Image.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Page")) { - return await Page.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Video")) { - return await Video.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Event")) { - return await Event.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Group")) { - return await Group.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Note")) { - return await Note.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Organization")) { - return await Organization.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Person")) { - return await Person.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Place")) { - return await Place.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Profile")) { - return await Profile.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Relationship")) { - return await Relationship.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Service")) { - return await Service.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Tombstone")) { - return await Tombstone.fromJsonLd(json, options); - } - - if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Object")) { - throw new TypeError("Invalid type: " + values["@type"]); + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Organization", + ) + ) { + return await Organization.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Person") + ) { + return await Person.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Place") + ) { + return await Place.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Profile", + ) + ) { + return await Profile.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Relationship", + ) + ) { + return await Relationship.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Service", + ) + ) { + return await Service.fromJsonLd(json, options); + } + + if ( + values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Tombstone", + ) + ) { + return await Tombstone.fromJsonLd(json, options); + } + + if ( + !values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Object", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } } - } - + const instance = new this( { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, options, ); - const _49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; + const _49BipA5dq9eoH8LX8xdsVumveTca_attachment: + (Object | Link | PropertyValue | URL)[] = []; + + let _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array = + values["https://www.w3.org/ns/activitystreams#attachment"]; - let _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array = values["https://www.w3.org/ns/activitystreams#attachment"]; - for ( const v of _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array == null ? [] - : _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array.length === 1 && "@list" in _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array[0] + : _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array.length === 1 && + "@list" in _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array[0] ? _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array[0]["@list"] : _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _49BipA5dq9eoH8LX8xdsVumveTca_attachment.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("http://schema.org#PropertyValue") ? await PropertyValue.fromJsonLd( - v, options) : undefined - ; + + 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + v["@type"].includes("http://schema.org#PropertyValue") + ? await PropertyValue.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _49BipA5dq9eoH8LX8xdsVumveTca_attachment.push(decoded); - } - instance.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = _49BipA5dq9eoH8LX8xdsVumveTca_attachment; - const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; + instance.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = + _49BipA5dq9eoH8LX8xdsVumveTca_attachment; + const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: + (Application | Group | Organization | Person | Service | URL)[] = []; + + let _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array = + values["https://www.w3.org/ns/activitystreams#attributedTo"]; - let _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array = values["https://www.w3.org/ns/activitystreams#attributedTo"]; - for ( const v of _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array == null ? [] - : _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array.length === 1 && "@list" in _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array[0] + : _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array.length === 1 && + "@list" in _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array[0] ? _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array[0]["@list"] : _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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) : 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) : 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) : 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) : 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) : undefined - ; + + 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : undefined; if (typeof decoded === "undefined") continue; _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.push(decoded); - } - instance.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + instance.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = + _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; const _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - let _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array = values["https://www.w3.org/ns/activitystreams#audience"]; - + let _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array = + values["https://www.w3.org/ns/activitystreams#audience"]; + for ( const v of _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array == null ? [] - : _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array.length === 1 && "@list" in _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array[0] + : _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array.length === 1 && + "@list" in _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array[0] ? _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array[0]["@list"] : _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.push(await Object.fromJsonLd( - v, options)) + _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; - const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; + instance.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = + _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = + []; + + let _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array = + values["https://www.w3.org/ns/activitystreams#content"]; - let _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array = values["https://www.w3.org/ns/activitystreams#content"]; - for ( const v of _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array == null ? [] - : _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array.length === 1 && "@list" in _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array[0] + : _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array.length === 1 && + "@list" in _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array[0] ? _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__array[0]["@list"] : _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content__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 - ; + + 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; _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.push(decoded); - } - instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; + instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = + _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; const _3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - let _3mhZzGXSpQ431mBSz2kvych22v4e_context__array = values["https://www.w3.org/ns/activitystreams#context"]; - + let _3mhZzGXSpQ431mBSz2kvych22v4e_context__array = + values["https://www.w3.org/ns/activitystreams#context"]; + for ( const v of _3mhZzGXSpQ431mBSz2kvych22v4e_context__array == null ? [] - : _3mhZzGXSpQ431mBSz2kvych22v4e_context__array.length === 1 && "@list" in _3mhZzGXSpQ431mBSz2kvych22v4e_context__array[0] + : _3mhZzGXSpQ431mBSz2kvych22v4e_context__array.length === 1 && + "@list" in _3mhZzGXSpQ431mBSz2kvych22v4e_context__array[0] ? _3mhZzGXSpQ431mBSz2kvych22v4e_context__array[0]["@list"] : _3mhZzGXSpQ431mBSz2kvych22v4e_context__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3mhZzGXSpQ431mBSz2kvych22v4e_context.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : undefined - ; + + 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _3mhZzGXSpQ431mBSz2kvych22v4e_context.push(decoded); - } - instance.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = _3mhZzGXSpQ431mBSz2kvych22v4e_context; - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; + instance.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = + _3mhZzGXSpQ431mBSz2kvych22v4e_context; + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = + []; + + let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = + values["https://www.w3.org/ns/activitystreams#name"]; - let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values["https://www.w3.org/ns/activitystreams#name"]; - for ( const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null ? [] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && "@list" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] + : _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 - ; + + 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); - } - instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; const _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime: (Temporal.Instant)[] = []; - let _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array = values["https://www.w3.org/ns/activitystreams#endTime"]; - + let _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array = + values["https://www.w3.org/ns/activitystreams#endTime"]; + for ( const v of _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array == null ? [] - : _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array.length === 1 && "@list" in _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array[0] + : _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array.length === 1 && + "@list" in _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array[0] ? _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array[0]["@list"] : _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array ) { if (v == null) continue; - _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.push(Temporal.Instant.from( + _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.push(Temporal.Instant.from( v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] - : v["@value"] + "Z" - )) + : v["@value"] + "Z", + )); } - instance.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; + instance.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = + _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; const _86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - let _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array = values["https://www.w3.org/ns/activitystreams#generator"]; - + let _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array = + values["https://www.w3.org/ns/activitystreams#generator"]; + for ( const v of _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array == null ? [] - : _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array.length === 1 && "@list" in _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array[0] + : _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array.length === 1 && + "@list" in _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array[0] ? _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array[0]["@list"] : _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _86xFhmgBapoMvYqjbjRuDPayTrS_generator.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : undefined - ; + + 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _86xFhmgBapoMvYqjbjRuDPayTrS_generator.push(decoded); - } - instance.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = _86xFhmgBapoMvYqjbjRuDPayTrS_generator; + instance.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = + _86xFhmgBapoMvYqjbjRuDPayTrS_generator; const _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - let _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array = values["https://www.w3.org/ns/activitystreams#icon"]; - + let _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array = + values["https://www.w3.org/ns/activitystreams#icon"]; + for ( const v of _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array == null ? [] - : _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array.length === 1 && "@list" in _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array[0] + : _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array.length === 1 && + "@list" in _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array[0] ? _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array[0]["@list"] : _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(await Image.fromJsonLd( - v, options)) + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push( + await Image.fromJsonLd( + v, + options, + ), + ); } - instance.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + instance.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; const _3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - let _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array = values["https://www.w3.org/ns/activitystreams#image"]; - + let _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array = + values["https://www.w3.org/ns/activitystreams#image"]; + for ( const v of _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array == null ? [] - : _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array.length === 1 && "@list" in _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array[0] + : _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array.length === 1 && + "@list" in _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array[0] ? _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array[0]["@list"] : _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(await Image.fromJsonLd( - v, options)) + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push( + await Image.fromJsonLd( + v, + options, + ), + ); } - instance.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + instance.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - let _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array = values["https://www.w3.org/ns/activitystreams#inReplyTo"]; - + let _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array = + values["https://www.w3.org/ns/activitystreams#inReplyTo"]; + for ( const v of _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array == null ? [] - : _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array.length === 1 && "@list" in _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array[0] + : _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array.length === 1 && + "@list" in _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array[0] ? _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array[0]["@list"] : _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : undefined - ; + + 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.push(decoded); - } - instance.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + instance.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = + _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; const _31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - let _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array = values["https://www.w3.org/ns/activitystreams#location"]; - + let _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array = + values["https://www.w3.org/ns/activitystreams#location"]; + for ( const v of _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array == null ? [] - : _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array.length === 1 && "@list" in _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array[0] + : _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array.length === 1 && + "@list" in _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array[0] ? _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array[0]["@list"] : _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _31k5MUZJsnsPNg8dQQJieWaXTFnR_location.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : undefined - ; + + 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _31k5MUZJsnsPNg8dQQJieWaXTFnR_location.push(decoded); - } - instance.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + instance.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = + _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values["https://www.w3.org/ns/activitystreams#preview"]; - + let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = + values["https://www.w3.org/ns/activitystreams#preview"]; + for ( const v of _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array == null ? [] - : _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array.length === 1 && "@list" in _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array[0] + : _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array.length === 1 && + "@list" in _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array[0] ? _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array[0]["@list"] : _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _gCVTegXxWWCw6wWRxa1QF65zusg_preview.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - const decoded = - typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : undefined - ; + + const decoded = typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _gCVTegXxWWCw6wWRxa1QF65zusg_preview.push(decoded); - } - instance.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = _gCVTegXxWWCw6wWRxa1QF65zusg_preview; + instance.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = + _gCVTegXxWWCw6wWRxa1QF65zusg_preview; const _5e258TDXtuhaFRPZiGoDfEpjdMr_published: (Temporal.Instant)[] = []; - let _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array = values["https://www.w3.org/ns/activitystreams#published"]; - + let _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array = + values["https://www.w3.org/ns/activitystreams#published"]; + for ( const v of _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array == null ? [] - : _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array.length === 1 && "@list" in _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array[0] + : _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array.length === 1 && + "@list" in _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array[0] ? _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array[0]["@list"] : _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array ) { if (v == null) continue; - _5e258TDXtuhaFRPZiGoDfEpjdMr_published.push(Temporal.Instant.from( + _5e258TDXtuhaFRPZiGoDfEpjdMr_published.push(Temporal.Instant.from( v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] - : v["@value"] + "Z" - )) + : v["@value"] + "Z", + )); } - instance.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = _5e258TDXtuhaFRPZiGoDfEpjdMr_published; + instance.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = + _5e258TDXtuhaFRPZiGoDfEpjdMr_published; const _7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - let _7UpwM3JWcXhADcscukEehBorf6k_replies__array = values["https://www.w3.org/ns/activitystreams#replies"]; - + let _7UpwM3JWcXhADcscukEehBorf6k_replies__array = + values["https://www.w3.org/ns/activitystreams#replies"]; + for ( const v of _7UpwM3JWcXhADcscukEehBorf6k_replies__array == null ? [] - : _7UpwM3JWcXhADcscukEehBorf6k_replies__array.length === 1 && "@list" in _7UpwM3JWcXhADcscukEehBorf6k_replies__array[0] + : _7UpwM3JWcXhADcscukEehBorf6k_replies__array.length === 1 && + "@list" in _7UpwM3JWcXhADcscukEehBorf6k_replies__array[0] ? _7UpwM3JWcXhADcscukEehBorf6k_replies__array[0]["@list"] : _7UpwM3JWcXhADcscukEehBorf6k_replies__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _7UpwM3JWcXhADcscukEehBorf6k_replies.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _7UpwM3JWcXhADcscukEehBorf6k_replies.push(await Collection.fromJsonLd( - v, options)) + _7UpwM3JWcXhADcscukEehBorf6k_replies.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_7UpwM3JWcXhADcscukEehBorf6k_replies = _7UpwM3JWcXhADcscukEehBorf6k_replies; + instance.#_7UpwM3JWcXhADcscukEehBorf6k_replies = + _7UpwM3JWcXhADcscukEehBorf6k_replies; const _3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - let _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array = values["https://www.w3.org/ns/activitystreams#shares"]; - + let _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array = + values["https://www.w3.org/ns/activitystreams#shares"]; + for ( const v of _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array == null ? [] - : _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array.length === 1 && "@list" in _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array[0] + : _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array.length === 1 && + "@list" in _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array[0] ? _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array[0]["@list"] : _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3kAfck9PcEYt2L7xug5y99YPbANs_shares.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3kAfck9PcEYt2L7xug5y99YPbANs_shares.push(await Collection.fromJsonLd( - v, options)) + _3kAfck9PcEYt2L7xug5y99YPbANs_shares.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = _3kAfck9PcEYt2L7xug5y99YPbANs_shares; + instance.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = + _3kAfck9PcEYt2L7xug5y99YPbANs_shares; const _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - let _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array = values["https://www.w3.org/ns/activitystreams#likes"]; - + let _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array = + values["https://www.w3.org/ns/activitystreams#likes"]; + for ( const v of _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array == null ? [] - : _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array.length === 1 && "@list" in _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array[0] + : _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array.length === 1 && + "@list" in _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array[0] ? _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array[0]["@list"] : _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.push(await Collection.fromJsonLd( - v, options)) + _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; - const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; + instance.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = + _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; + const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = + []; + + let _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array = + values["http://fedibird.com/ns#emojiReactions"]; - let _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array = values["http://fedibird.com/ns#emojiReactions"]; - for ( const v of _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array == null ? [] - : _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array.length === 1 && "@list" in _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array[0] + : _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array.length === 1 && + "@list" in _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array[0] ? _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array[0]["@list"] : _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.push(await Collection.fromJsonLd( - v, options)) + _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; + instance.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = + _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; const _2w3Jmue4up8iVDUA51WZqomEF438_startTime: (Temporal.Instant)[] = []; - let _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array = values["https://www.w3.org/ns/activitystreams#startTime"]; - + let _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array = + values["https://www.w3.org/ns/activitystreams#startTime"]; + for ( const v of _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array == null ? [] - : _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array.length === 1 && "@list" in _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array[0] + : _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array.length === 1 && + "@list" in _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array[0] ? _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array[0]["@list"] : _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array ) { if (v == null) continue; - _2w3Jmue4up8iVDUA51WZqomEF438_startTime.push(Temporal.Instant.from( + _2w3Jmue4up8iVDUA51WZqomEF438_startTime.push(Temporal.Instant.from( v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] - : v["@value"] + "Z" - )) + : v["@value"] + "Z", + )); } - instance.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = _2w3Jmue4up8iVDUA51WZqomEF438_startTime; - const _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = []; + instance.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = + _2w3Jmue4up8iVDUA51WZqomEF438_startTime; + const _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = + []; + + let _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array = + values["https://www.w3.org/ns/activitystreams#summary"]; - let _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array = values["https://www.w3.org/ns/activitystreams#summary"]; - for ( const v of _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array == null ? [] - : _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array.length === 1 && "@list" in _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array[0] + : _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array.length === 1 && + "@list" in _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array[0] ? _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__array[0]["@list"] : _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary__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 - ; + + 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; _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.push(decoded); - } - instance.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; + instance.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = + _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; const _5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - let _5chuqj6s95p5gg2sk1HntGfarRf_tag__array = values["https://www.w3.org/ns/activitystreams#tag"]; - + let _5chuqj6s95p5gg2sk1HntGfarRf_tag__array = + values["https://www.w3.org/ns/activitystreams#tag"]; + for ( const v of _5chuqj6s95p5gg2sk1HntGfarRf_tag__array == null ? [] - : _5chuqj6s95p5gg2sk1HntGfarRf_tag__array.length === 1 && "@list" in _5chuqj6s95p5gg2sk1HntGfarRf_tag__array[0] + : _5chuqj6s95p5gg2sk1HntGfarRf_tag__array.length === 1 && + "@list" in _5chuqj6s95p5gg2sk1HntGfarRf_tag__array[0] ? _5chuqj6s95p5gg2sk1HntGfarRf_tag__array[0]["@list"] : _5chuqj6s95p5gg2sk1HntGfarRf_tag__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _5chuqj6s95p5gg2sk1HntGfarRf_tag.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - - 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( - t => v["@type"].includes(t)) ? await Object.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : undefined - ; + + 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( + (t) => v["@type"].includes(t), + ) + ? await Object.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _5chuqj6s95p5gg2sk1HntGfarRf_tag.push(decoded); - } - instance.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = _5chuqj6s95p5gg2sk1HntGfarRf_tag; + instance.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = + _5chuqj6s95p5gg2sk1HntGfarRf_tag; const _385aB7ySixcf5Un6z3VsWmThgCzQ_updated: (Temporal.Instant)[] = []; - let _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array = values["https://www.w3.org/ns/activitystreams#updated"]; - + let _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array = + values["https://www.w3.org/ns/activitystreams#updated"]; + for ( const v of _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array == null ? [] - : _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array.length === 1 && "@list" in _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array[0] + : _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array.length === 1 && + "@list" in _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array[0] ? _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array[0]["@list"] : _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array ) { if (v == null) continue; - _385aB7ySixcf5Un6z3VsWmThgCzQ_updated.push(Temporal.Instant.from( + _385aB7ySixcf5Un6z3VsWmThgCzQ_updated.push(Temporal.Instant.from( v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] - : v["@value"] + "Z" - )) + : v["@value"] + "Z", + )); } - instance.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = _385aB7ySixcf5Un6z3VsWmThgCzQ_updated; + instance.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = + _385aB7ySixcf5Un6z3VsWmThgCzQ_updated; const _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url: ((URL | Link))[] = []; - let _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array = values["https://www.w3.org/ns/activitystreams#url"]; - + let _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array = + values["https://www.w3.org/ns/activitystreams#url"]; + for ( const v of _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array == null ? [] - : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array.length === 1 && "@list" in _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0] + : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array.length === 1 && + "@list" in _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0] ? _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array[0]["@list"] : _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url__array ) { if (v == null) continue; - - const decoded = - typeof v === "object" && "@id" in v - && typeof v["@id"] === "string" - && v["@id"] !== "" && v["@id"] !== "/" ? new URL(v["@id"]) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Link","https://www.w3.org/ns/activitystreams#Hashtag","https://www.w3.org/ns/activitystreams#Mention"].some( - t => v["@type"].includes(t)) ? await Link.fromJsonLd( - v, options) : undefined - ; + + const decoded = typeof v === "object" && "@id" in v && + typeof v["@id"] === "string" && + v["@id"] !== "" && v["@id"] !== "/" + ? new URL(v["@id"]) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + [ + "https://www.w3.org/ns/activitystreams#Link", + "https://www.w3.org/ns/activitystreams#Hashtag", + "https://www.w3.org/ns/activitystreams#Mention", + ].some( + (t) => v["@type"].includes(t), + ) + ? await Link.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.push(decoded); - } - instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = + _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - let _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array = values["https://www.w3.org/ns/activitystreams#to"]; - + let _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array = + values["https://www.w3.org/ns/activitystreams#to"]; + for ( const v of _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array == null ? [] - : _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array.length === 1 && "@list" in _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array[0] + : _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array.length === 1 && + "@list" in _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array[0] ? _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array[0]["@list"] : _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.push(await Object.fromJsonLd( - v, options)) + _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + instance.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = + _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - let _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array = values["https://www.w3.org/ns/activitystreams#bto"]; - + let _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array = + values["https://www.w3.org/ns/activitystreams#bto"]; + for ( const v of _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array == null ? [] - : _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array.length === 1 && "@list" in _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array[0] + : _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array.length === 1 && + "@list" in _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array[0] ? _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array[0]["@list"] : _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.push(await Object.fromJsonLd( - v, options)) + _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + instance.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = + _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - let _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array = values["https://www.w3.org/ns/activitystreams#cc"]; - + let _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array = + values["https://www.w3.org/ns/activitystreams#cc"]; + for ( const v of _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array == null ? [] - : _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array.length === 1 && "@list" in _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array[0] + : _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array.length === 1 && + "@list" in _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array[0] ? _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array[0]["@list"] : _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.push(await Object.fromJsonLd( - v, options)) + _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + instance.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = + _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - let _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array = values["https://www.w3.org/ns/activitystreams#bcc"]; - + let _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array = + values["https://www.w3.org/ns/activitystreams#bcc"]; + for ( const v of _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array == null ? [] - : _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array.length === 1 && "@list" in _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array[0] + : _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array.length === 1 && + "@list" in _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array[0] ? _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array[0]["@list"] : _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.push(await Object.fromJsonLd( - v, options)) + _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + instance.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = + _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; const _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType: (string)[] = []; - let _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array = values["https://www.w3.org/ns/activitystreams#mediaType"]; - + let _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array = + values["https://www.w3.org/ns/activitystreams#mediaType"]; + for ( const v of _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array == null ? [] - : _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array.length === 1 && "@list" in _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array[0] + : _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array.length === 1 && + "@list" in _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array[0] ? _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array[0]["@list"] : _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType__array ) { if (v == null) continue; - _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.push(v["@value"]) + _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.push(v["@value"]); } - instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; + instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = + _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; const _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration: (Temporal.Duration)[] = []; - let _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array = values["https://www.w3.org/ns/activitystreams#duration"]; - + let _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array = + values["https://www.w3.org/ns/activitystreams#duration"]; + for ( const v of _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array == null ? [] - : _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array.length === 1 && "@list" in _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array[0] + : _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array.length === 1 && + "@list" in _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array[0] ? _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array[0]["@list"] : _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array ) { if (v == null) continue; - _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.push(Temporal.Duration.from(v["@value"])) + _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.push( + Temporal.Duration.from(v["@value"]), + ); } - instance.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration; + instance.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = + _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration; const _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive: (boolean)[] = []; - let _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array = values["https://www.w3.org/ns/activitystreams#sensitive"]; - + let _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array = + values["https://www.w3.org/ns/activitystreams#sensitive"]; + for ( const v of _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array == null ? [] - : _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array.length === 1 && "@list" in _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array[0] + : _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array.length === 1 && + "@list" in _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array[0] ? _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array[0]["@list"] : _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive__array ) { if (v == null) continue; - _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.push(v["@value"]) + _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.push(v["@value"]); } - instance.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive; + instance.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = + _u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive; const _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source: (Source)[] = []; - let _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array = values["https://www.w3.org/ns/activitystreams#source"]; - + let _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array = + values["https://www.w3.org/ns/activitystreams#source"]; + for ( const v of _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array == null ? [] - : _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array.length === 1 && "@list" in _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array[0] + : _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array.length === 1 && + "@list" in _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array[0] ? _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array[0]["@list"] : _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source__array ) { if (v == null) continue; - _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.push(await Source.fromJsonLd( - v, options)) + _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.push( + await Source.fromJsonLd( + v, + options, + ), + ); } - instance.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; - const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; + instance.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = + _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; + const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = + []; + + let _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array = + values["https://w3id.org/security#proof"]; - let _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array = values["https://w3id.org/security#proof"]; - for ( const v of _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array == null ? [] - : _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array.length === 1 && "@list" in _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array[0] + : _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array.length === 1 && + "@list" in _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array[0] ? _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array[0]["@list"] : _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.push(await DataIntegrityProof.fromJsonLd( - v, options)) + _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.push( + await DataIntegrityProof.fromJsonLd( + v, + options, + ), + ); } - instance.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; - + instance.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = + _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -8606,9 +9728,8 @@ get urls(): ((URL | Link))[] { } return instance; } - - protected _getCustomInspectProxy(): Record { - + + protected _getCustomInspectProxy(): Record { const proxy: Record = {}; if (this.id != null) { proxy.id = { @@ -8623,756 +9744,892 @@ get urls(): ((URL | Link))[] { ): string => "URL " + inspect(this.id!.href, options), }; } - - const _49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + + const _49BipA5dq9eoH8LX8xdsVumveTca_attachment = this + .#_49BipA5dq9eoH8LX8xdsVumveTca_attachment + // 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 (_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length > 1 - || !("attachment" in proxy) - && _49BipA5dq9eoH8LX8xdsVumveTca_attachment.length > 0) { - proxy.attachments = _49BipA5dq9eoH8LX8xdsVumveTca_attachment; - } - - const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo - // 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 ( + _49BipA5dq9eoH8LX8xdsVumveTca_attachment.length > 1 || + !("attachment" in proxy) && + _49BipA5dq9eoH8LX8xdsVumveTca_attachment.length > 0 + ) { + proxy.attachments = _49BipA5dq9eoH8LX8xdsVumveTca_attachment; + } + + const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this + .#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo + // 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 (_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length == 1) { - proxy.attribution = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; - } - - if (_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length > 1 - || !("attribution" in proxy) - && _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length > 0) { - proxy.attributions = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; - } - - const _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience - // 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 (_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length == 1) { + proxy.attribution = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; + } + + if ( + _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length > 1 || + !("attribution" in proxy) && + _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length > 0 + ) { + proxy.attributions = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + } + + const _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this + .#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience + // 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 (_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length == 1) { - proxy.audience = _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; - } - - if (_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length > 1 - || !("audience" in proxy) - && _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length > 0) { - proxy.audiences = _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; - } - - const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content - // 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 (_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length == 1) { + proxy.audience = _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; + } + + if ( + _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length > 1 || + !("audience" in proxy) && + _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length > 0 + ) { + proxy.audiences = _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + } + + const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this + .#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content + // 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 (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length == 1) { - proxy.content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; - } - - if (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 1 - || !("content" in proxy) - && _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 0) { - proxy.contents = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; - } - - const _3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context - // 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 (_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length == 1) { + proxy.content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content[0]; + } + + if ( + _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 1 || + !("content" in proxy) && + _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length > 0 + ) { + proxy.contents = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; + } + + const _3mhZzGXSpQ431mBSz2kvych22v4e_context = this + .#_3mhZzGXSpQ431mBSz2kvych22v4e_context + // 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 (_3mhZzGXSpQ431mBSz2kvych22v4e_context.length > 1 - || !("context" in proxy) - && _3mhZzGXSpQ431mBSz2kvych22v4e_context.length > 0) { - proxy.contexts = _3mhZzGXSpQ431mBSz2kvych22v4e_context; - } - - const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name - // 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 ( + _3mhZzGXSpQ431mBSz2kvych22v4e_context.length > 1 || + !("context" in proxy) && + _3mhZzGXSpQ431mBSz2kvych22v4e_context.length > 0 + ) { + proxy.contexts = _3mhZzGXSpQ431mBSz2kvych22v4e_context; + } + + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this + .#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name + // 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 (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { - proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; - } - - if (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 1 - || !("name" in proxy) - && _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0) { - proxy.names = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - } - - const _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime - // 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 (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + } + + if ( + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 1 || + !("name" in proxy) && + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length > 0 + ) { + proxy.names = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + } + + const _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this + .#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime + // 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 (_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length == 1) { - proxy.endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime[0]; - } - - const _86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator - // 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 (_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length == 1) { + proxy.endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime[0]; + } + + const _86xFhmgBapoMvYqjbjRuDPayTrS_generator = this + .#_86xFhmgBapoMvYqjbjRuDPayTrS_generator + // 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 (_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length > 1 - || !("generator" in proxy) - && _86xFhmgBapoMvYqjbjRuDPayTrS_generator.length > 0) { - proxy.generators = _86xFhmgBapoMvYqjbjRuDPayTrS_generator; - } - - const _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon - // 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 ( + _86xFhmgBapoMvYqjbjRuDPayTrS_generator.length > 1 || + !("generator" in proxy) && + _86xFhmgBapoMvYqjbjRuDPayTrS_generator.length > 0 + ) { + proxy.generators = _86xFhmgBapoMvYqjbjRuDPayTrS_generator; + } + + const _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this + .#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon + // 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 (_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length == 1) { - proxy.icon = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; - } - - if (_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length > 1 - || !("icon" in proxy) - && _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length > 0) { - proxy.icons = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; - } - - const _3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image - // 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 (_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length == 1) { + proxy.icon = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; + } + + if ( + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length > 1 || + !("icon" in proxy) && + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length > 0 + ) { + proxy.icons = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + } + + const _3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this + .#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image + // 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 (_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length == 1) { - proxy.image = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; - } - - if (_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length > 1 - || !("image" in proxy) - && _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length > 0) { - proxy.images = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; - } - - const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo - // 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 (_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length == 1) { + proxy.image = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; + } + + if ( + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length > 1 || + !("image" in proxy) && + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length > 0 + ) { + proxy.images = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + } + + const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this + .#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo + // 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 (_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length == 1) { - proxy.replyTarget = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; - } - - if (_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length > 1 - || !("replyTarget" in proxy) - && _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length > 0) { - proxy.replyTargets = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; - } - - const _31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location - // 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 (_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length == 1) { + proxy.replyTarget = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; + } + + if ( + _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length > 1 || + !("replyTarget" in proxy) && + _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length > 0 + ) { + proxy.replyTargets = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + } + + const _31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this + .#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location + // 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 (_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length == 1) { - proxy.location = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; - } - - if (_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length > 1 - || !("location" in proxy) - && _31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length > 0) { - proxy.locations = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; - } - - const _gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview - // 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 (_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length == 1) { + proxy.location = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; + } + + if ( + _31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length > 1 || + !("location" in proxy) && + _31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length > 0 + ) { + proxy.locations = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + } + + const _gCVTegXxWWCw6wWRxa1QF65zusg_preview = this + .#_gCVTegXxWWCw6wWRxa1QF65zusg_preview + // 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 (_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length == 1) { - proxy.preview = _gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; - } - - if (_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length > 1 - || !("preview" in proxy) - && _gCVTegXxWWCw6wWRxa1QF65zusg_preview.length > 0) { - proxy.previews = _gCVTegXxWWCw6wWRxa1QF65zusg_preview; - } - - const _5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published - // 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 (_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length == 1) { + proxy.preview = _gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; + } + + if ( + _gCVTegXxWWCw6wWRxa1QF65zusg_preview.length > 1 || + !("preview" in proxy) && + _gCVTegXxWWCw6wWRxa1QF65zusg_preview.length > 0 + ) { + proxy.previews = _gCVTegXxWWCw6wWRxa1QF65zusg_preview; + } + + const _5e258TDXtuhaFRPZiGoDfEpjdMr_published = this + .#_5e258TDXtuhaFRPZiGoDfEpjdMr_published + // 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 (_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length == 1) { - proxy.published = _5e258TDXtuhaFRPZiGoDfEpjdMr_published[0]; - } - - const _7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies - // 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 (_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length == 1) { + proxy.published = _5e258TDXtuhaFRPZiGoDfEpjdMr_published[0]; + } + + const _7UpwM3JWcXhADcscukEehBorf6k_replies = this + .#_7UpwM3JWcXhADcscukEehBorf6k_replies + // 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 (_7UpwM3JWcXhADcscukEehBorf6k_replies.length == 1) { - proxy.replies = _7UpwM3JWcXhADcscukEehBorf6k_replies[0]; - } - - const _3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares - // 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 (_7UpwM3JWcXhADcscukEehBorf6k_replies.length == 1) { + proxy.replies = _7UpwM3JWcXhADcscukEehBorf6k_replies[0]; + } + + const _3kAfck9PcEYt2L7xug5y99YPbANs_shares = this + .#_3kAfck9PcEYt2L7xug5y99YPbANs_shares + // 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 (_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length == 1) { - proxy.shares = _3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; - } - - const _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes - // 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 (_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length == 1) { + proxy.shares = _3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; + } + + const _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this + .#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes + // 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 (_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length == 1) { - proxy.likes = _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; - } - - const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions - // 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 (_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length == 1) { + proxy.likes = _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; + } + + const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this + .#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions + // 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 (_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length == 1) { - proxy.emojiReactions = _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; - } - - const _2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime - // 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 (_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length == 1) { + proxy.emojiReactions = _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; + } + + const _2w3Jmue4up8iVDUA51WZqomEF438_startTime = this + .#_2w3Jmue4up8iVDUA51WZqomEF438_startTime + // 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 (_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length == 1) { - proxy.startTime = _2w3Jmue4up8iVDUA51WZqomEF438_startTime[0]; - } - - const _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary - // 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 (_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length == 1) { + proxy.startTime = _2w3Jmue4up8iVDUA51WZqomEF438_startTime[0]; + } + + const _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this + .#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary + // 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 (_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length == 1) { - proxy.summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary[0]; - } - - if (_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 1 - || !("summary" in proxy) - && _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0) { - proxy.summaries = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; - } - - const _5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag - // 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 (_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length == 1) { + proxy.summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary[0]; + } + + if ( + _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 1 || + !("summary" in proxy) && + _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length > 0 + ) { + proxy.summaries = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; + } + + const _5chuqj6s95p5gg2sk1HntGfarRf_tag = this + .#_5chuqj6s95p5gg2sk1HntGfarRf_tag + // 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 (_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 ( + _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 (_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 (_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 (_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 (_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 (_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 (_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 (_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 (_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 (_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 (_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; - } - + [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; + } + return proxy; } // @ts-ignore: suppressing TS4127 - [Symbol.for("Deno.customInspect")]( + [Symbol.for("Deno.customInspect")]( inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { @@ -9381,7 +10638,7 @@ get urls(): ((URL | Link))[] { } // @ts-ignore: suppressing TS4127 - [Symbol.for("nodejs.util.inspect.custom")]( + [Symbol.for("nodejs.util.inspect.custom")]( _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, @@ -9389,53 +10646,91 @@ get urls(): ((URL | Link))[] { 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"); + } - /** - * 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)[];} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + 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)[]; + }, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - super(values, options);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -9444,45 +10739,82 @@ proofs?: (DataIntegrityProof | URL)[];} * @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)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + 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)[]; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): Emoji { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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; + 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. @@ -9494,9 +10826,12 @@ proofs?: (DataIntegrityProof | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -9504,34 +10839,36 @@ proofs?: (DataIntegrityProof | URL)[];} 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'." + "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"}]; + 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", @@ -9541,7 +10878,7 @@ proofs?: (DataIntegrityProof | URL)[];} 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") { @@ -9551,7 +10888,10 @@ 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", { + "toot": "http://joinmastodon.org/ns#", + "Emoji": "toot:Emoji", + }]; const compacted = await jsonld.compact( values, docContext, @@ -9559,27 +10899,27 @@ proofs?: (DataIntegrityProof | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -9594,9 +10934,9 @@ proofs?: (DataIntegrityProof | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -9609,7 +10949,10 @@ proofs?: (DataIntegrityProof | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Emoji__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -9631,15 +10974,14 @@ proofs?: (DataIntegrityProof | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -9659,18 +11001,19 @@ proofs?: (DataIntegrityProof | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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"]); + + 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, @@ -9680,7 +11023,7 @@ proofs?: (DataIntegrityProof | URL)[];} if (!(instance instanceof Emoji)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -9693,9 +11036,9 @@ proofs?: (DataIntegrityProof | URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -9717,23 +11060,21 @@ proofs?: (DataIntegrityProof | URL)[];} 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"); - } + /** + * 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)[] = []; /** @@ -9742,46 +11083,85 @@ export class ChatMessage extends Object { * @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)[];quoteUrl?: URL | null;} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + 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)[]; + 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" + ".", - ); - } - } + 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. @@ -9790,80 +11170,119 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} * @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)[];quoteUrl?: URL | null;} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + 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)[]; + quoteUrl?: URL | null; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): ChatMessage { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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" + ".", - ); - } - } - + 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]; - } - + + /** 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. @@ -9875,9 +11294,12 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -9885,60 +11307,69 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} 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'." + "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 - ); + const item = v.href; compactItems.push(item); } if (compactItems.length > 0) { - - result["quoteUrl"] - = compactItems.length > 1 + 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["_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"}}]; + 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[]; - + const baseValues = await super.toJsonLd({ ...options, format: "expand", @@ -9948,26 +11379,21 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} string, unknown[] | { "@list": unknown[] } | string >; - + array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const element = ( - { "@value": v.href } - ); - array.push(element);; + const element = { "@value": v.href }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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["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") { @@ -9977,7 +11403,24 @@ 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://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", + }, + }, + ]; const compacted = await jsonld.compact( values, docContext, @@ -9985,27 +11428,27 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -10020,9 +11463,9 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -10035,7 +11478,10 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} async (span) => { try { const object = await this.__fromJsonLd__ChatMessage__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -10057,15 +11503,14 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -10085,18 +11530,19 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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"]); + + 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, @@ -10108,28 +11554,39 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} } 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"]; - } - + 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.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"])) + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v["@value"])); } - instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; - + instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -10142,29 +11599,32 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} } 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 + 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]; - } - + [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; } @@ -10186,29 +11646,28 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} 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)[] = []; -#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; -#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; -#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; -#_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; -#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; + /** + * 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)[] = []; + #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; + #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; + #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; + #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; + #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; /** * Constructs a new instance of Activity with the given values. @@ -10216,244 +11675,324 @@ export class Activity extends Object { * @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, + 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]; - } 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; - } 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]; - } 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; - } 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]; - } 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; - } 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]; - } 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; - } 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]; - } 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; - } 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]; - } 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; - } else { - throw new TypeError( - "The instruments must be an array of type " + - "Object | URL" + ".", - ); - } - } + 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]; + } 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; + } 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]; + } 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; + } 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]; + } 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; + } 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]; + } 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; + } 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]; + } 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; + } 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]; + } 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; + } else { + throw new TypeError( + "The instruments must be an array of type " + + "Object | URL" + ".", + ); + } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -10462,275 +12001,363 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): Activity { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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; - 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]; - } 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; - } else { - throw new TypeError( - "The actors must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_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]; - } 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; - } else { - throw new TypeError( - "The objects must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_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]; - } 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; - } else { - throw new TypeError( - "The targets must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_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]; - } 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; - } else { - throw new TypeError( - "The results must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_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]; - } 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; - } else { - throw new TypeError( - "The origins must be an array of type " + - "Object | URL" + ".", - ); - } - } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_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]; - } 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; - } else { - throw new TypeError( - "The instruments must be an array of type " + - "Object | URL" + ".", - ); - } - } - + const clone = super.clone(values, options) as unknown as Activity; + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = + this.#_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]; + } 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; + } else { + throw new TypeError( + "The actors must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = + this.#_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]; + } 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; + } else { + throw new TypeError( + "The objects must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = + this.#_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]; + } 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; + } else { + throw new TypeError( + "The targets must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = + this.#_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]; + } 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; + } else { + throw new TypeError( + "The results must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = + this.#_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]; + } 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; + } else { + throw new TypeError( + "The origins must be an array of type " + + "Object | URL" + ".", + ); + } + } + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = + this.#_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]; + } 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; + } 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, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + async #fetchActor( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -10743,7 +12370,7 @@ instruments?: (Object | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -10753,20 +12380,20 @@ instruments?: (Object | URL)[];} try { const obj = await this.#actor_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -10778,230 +12405,240 @@ instruments?: (Object | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #actor_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #actor_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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}. - * - */ + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchActor(v, options); + if (fetched == null) return null; + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#actor_fromJsonLd(obj, options); + } + } + + 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); + } - async getActor( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchActor(v, options); - if (fetched == null) return null; - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#actor_fromJsonLd(obj, options); - } - } - - 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}. - * - */ + /** 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, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchActor( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#actor_fromJsonLd(obj, options); - continue; - } - } - - yield v; + async *getActors( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchActor( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#actor_fromJsonLd(obj, options); + continue; } } - - async #fetchObject( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchObject( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -11014,7 +12651,7 @@ instruments?: (Object | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -11024,20 +12661,20 @@ instruments?: (Object | URL)[];} try { const obj = await this.#object_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -11049,194 +12686,198 @@ instruments?: (Object | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #object_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #object_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getObject( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchObject(v, options); - if (fetched == null) return null; - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#object_fromJsonLd(obj, options); - } - } - - 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. - * - */ + /** + * 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; + } - async* getObjects( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchObject( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#object_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchObject(v, options); + if (fetched == null) return null; + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#object_fromJsonLd(obj, options); + } + } + + 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; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchObject( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#object_fromJsonLd(obj, options); + continue; } } - - async #fetchTarget( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchTarget( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -11249,7 +12890,7 @@ instruments?: (Object | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -11259,20 +12900,20 @@ instruments?: (Object | URL)[];} try { const obj = await this.#target_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -11284,200 +12925,204 @@ instruments?: (Object | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #target_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #target_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getTarget( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchTarget(v, options); - if (fetched == null) return null; - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#target_fromJsonLd(obj, options); - } - } - - 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. - * - */ + /** + * 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; + } - async* getTargets( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchTarget( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#target_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchTarget(v, options); + if (fetched == null) return null; + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#target_fromJsonLd(obj, options); + } + } + + 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; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchTarget( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#target_fromJsonLd(obj, options); + continue; } } - - async #fetchResult( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchResult( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -11490,7 +13135,7 @@ instruments?: (Object | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -11500,20 +13145,20 @@ instruments?: (Object | URL)[];} try { const obj = await this.#result_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -11525,194 +13170,198 @@ instruments?: (Object | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #result_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #result_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getResult( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchResult(v, options); - if (fetched == null) return null; - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#result_fromJsonLd(obj, options); - } - } - - 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. - * - */ + /** + * 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; + } - async* getResults( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchResult( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#result_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchResult(v, options); + if (fetched == null) return null; + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#result_fromJsonLd(obj, options); + } + } + + 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; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchResult( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#result_fromJsonLd(obj, options); + continue; } } - - async #fetchOrigin( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchOrigin( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -11725,7 +13374,7 @@ instruments?: (Object | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -11735,20 +13384,20 @@ instruments?: (Object | URL)[];} try { const obj = await this.#origin_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -11760,196 +13409,200 @@ instruments?: (Object | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #origin_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #origin_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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". - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getOrigin( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchOrigin(v, options); - if (fetched == null) return null; - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#origin_fromJsonLd(obj, options); - } - } - - 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". - * - */ + /** + * 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; + } - async* getOrigins( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchOrigin( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#origin_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchOrigin(v, options); + if (fetched == null) return null; + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#origin_fromJsonLd(obj, options); + } + } + + 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; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchOrigin( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#origin_fromJsonLd(obj, options); + continue; } } - - async #fetchInstrument( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchInstrument( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -11962,7 +13615,7 @@ instruments?: (Object | URL)[];} if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -11972,20 +13625,20 @@ instruments?: (Object | URL)[];} try { const obj = await this.#instrument_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -11997,172 +13650,174 @@ instruments?: (Object | URL)[];} } finally { span.end(); } - }); + }, + ); + } + + async #instrument_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Object.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #instrument_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Object.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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}. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Object"].join(", "), + ); + } - async getInstrument( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - 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) { - const fetched = - await this.#fetchInstrument(v, options); - if (fetched == null) return null; - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; - 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 obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#instrument_fromJsonLd(obj, options); - } - } - - 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}. - * - */ + /** + * 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; + } - async* getInstruments( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchInstrument( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - 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) { - yield await this.#instrument_fromJsonLd(obj, options); - continue; - } - } - - yield v; + /** 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; + } = {}, + ): Promise { + 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) { + const fetched = await this.#fetchInstrument(v, options); + if (fetched == null) return null; + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0] = fetched; + 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 obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#instrument_fromJsonLd(obj, options); + } + } + + 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; + } = {}, + ): 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++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchInstrument( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + 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) { + yield await this.#instrument_fromJsonLd(obj, options); + continue; } } - + + yield v; + } + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -12174,9 +13829,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -12184,17 +13842,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -12204,97 +13862,87 @@ instruments?: (Object | URL)[];} 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);; + 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 - ); + 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);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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") { @@ -12304,7 +13952,12 @@ 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://w3id.org/identity/v1", + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + "https://w3id.org/security/data-integrity/v1", + ]; const compacted = await jsonld.compact( values, docContext, @@ -12312,27 +13965,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -12347,9 +14000,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -12362,7 +14015,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Activity__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -12384,15 +14040,14 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -12412,138 +14067,213 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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); - } - - 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 ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); } - - if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) { - throw new TypeError("Invalid 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); + } + + 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, @@ -12553,178 +14283,255 @@ instruments?: (Object | URL)[];} if (!(instance instanceof Activity)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; + const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: + (Application | Group | Organization | Person | Service | URL)[] = []; + + let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = + values["https://www.w3.org/ns/activitystreams#actor"]; - 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.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) { + + 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"]) + : 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) : 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) : 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) : 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) : 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) : undefined - ; + + 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : undefined; if (typeof decoded === "undefined") continue; _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.push(decoded); - } - instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = + _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values["https://www.w3.org/ns/activitystreams#object"]; - + 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.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) { + + 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"]) + : new URL(v["@id"]), ); continue; } - _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(await Object.fromJsonLd( - v, options)) + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = + _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values["https://www.w3.org/ns/activitystreams#target"]; - + 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.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) { + + 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"]) + : new URL(v["@id"]), ); continue; } - _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(await Object.fromJsonLd( - v, options)) + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = + _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values["https://www.w3.org/ns/activitystreams#result"]; - + 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.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) { + + 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"]) + : new URL(v["@id"]), ); continue; } - _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(await Object.fromJsonLd( - v, options)) + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = + _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values["https://www.w3.org/ns/activitystreams#origin"]; - + 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.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) { + + 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"]) + : new URL(v["@id"]), ); continue; } - _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(await Object.fromJsonLd( - v, options)) + _25zu2s3VxVujgEKqrDycjE284XQR_origin.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; + instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = + _25zu2s3VxVujgEKqrDycjE284XQR_origin; const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values["https://www.w3.org/ns/activitystreams#instrument"]; - + 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.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) { + + 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"]) + : new URL(v["@id"]), ); continue; } - _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(await Object.fromJsonLd( - v, options)) + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push( + await Object.fromJsonLd( + v, + options, + ), + ); } - instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; - + instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = + _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -12737,165 +14544,195 @@ instruments?: (Object | URL)[];} } 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 + 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 (_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 (_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 (_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 (_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 (_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; - } - + [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; } @@ -12917,60 +14754,110 @@ instruments?: (Object | URL)[];} 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"); + } - /** - * 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)[];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, + 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);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -12979,51 +14866,101 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): EmojiReact { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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; + 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. @@ -13035,9 +14972,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -13045,17 +14985,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -13065,7 +15005,7 @@ instruments?: (Object | URL)[];} 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") { @@ -13075,7 +15015,17 @@ 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", + { + "litepub": "http://litepub.social/ns#", + "toot": "http://joinmastodon.org/ns#", + "EmojiReact": "litepub:EmojiReact", + "Emoji": "toot:Emoji", + }, + ]; const compacted = await jsonld.compact( values, docContext, @@ -13083,27 +15033,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -13118,9 +15068,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -13133,7 +15083,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__EmojiReact__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -13155,15 +15108,14 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -13183,18 +15135,19 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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"]); + + 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, @@ -13204,7 +15157,7 @@ instruments?: (Object | URL)[];} if (!(instance instanceof EmojiReact)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -13217,9 +15170,9 @@ instruments?: (Object | URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -13241,59 +15194,58 @@ instruments?: (Object | URL)[];} 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; - 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 _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } - 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"); - } + /** + * 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))[] = []; + #_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; /** * Constructs a new instance of PropertyValue with the given values. @@ -13301,18 +15253,17 @@ export class PropertyValue { * @param options The options to use for initialization. */ constructor( - values: - { -id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} -, + values: { + id?: URL | null; + name?: string | LanguageString | null; + value?: string | LanguageString | null; + }, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; @@ -13328,31 +15279,36 @@ name?: string | LanguageString | null;value?: string | LanguageString | 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" + ".", - ); - } - } + + 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. @@ -13360,86 +15316,92 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * @options The options to use for cloning. * @returns The cloned instance. */ - clone( - values: - { -id?: URL | null; -name?: string | LanguageString | null;value?: string | LanguageString | null;} - - = {}, + clone( + values: { + id?: URL | null; + name?: string | LanguageString | null; + value?: string | LanguageString | null; + } = {}, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): PropertyValue { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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]; + 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" + ".", + ); } - -/** 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]; + } + 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. @@ -13450,10 +15412,13 @@ 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: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + async toJsonLd(options: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -13461,102 +15426,86 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} 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'." + "to 'compact'.", ); } options = { ...options, contextLoader: options.contextLoader ?? getDocumentLoader(), }; - + if (options.format == null && this.isCompactable()) { - const result: Record = {}; + 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.language.compact(), - } - ); + const item = typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.language.compact(), + }; compactItems.push(item); } if (compactItems.length > 0) { - - result["name"] - = compactItems.length > 1 + result["name"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { - const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.language.compact(), - } - ); + const item = typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.language.compact(), + }; compactItems.push(item); } if (compactItems.length > 0) { - - result["value"] - = compactItems.length > 1 + result["value"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + 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"}]; + result["@context"] = ["https://www.w3.org/ns/activitystreams", { + "schema": "http://schema.org#", + "PropertyValue": "schema:PropertyValue", + "value": "schema:value", + }]; return result; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + const values: Record = {}; array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { - const element = ( - typeof v === "string" ? { "@value": v } : { + const element = typeof v === "string" ? { "@value": v } : { "@value": v.toString(), "@language": v.language.compact(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#name"] = propValue; - } - + array = []; for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { - const element = ( - typeof v === "string" ? { "@value": v } : { + const element = typeof v === "string" ? { "@value": v } : { "@value": v.toString(), "@language": v.language.compact(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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") { @@ -13566,7 +15515,11 @@ 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", { + "schema": "http://schema.org#", + "PropertyValue": "schema:PropertyValue", + "value": "schema:value", + }]; const compacted = await jsonld.compact( values, docContext, @@ -13574,26 +15527,24 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); if (docContext != null) { // Embed context - } return compacted; } - protected isCompactable(): boolean { + protected 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; - 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; } - + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -13605,12 +15556,12 @@ 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 async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -13623,7 +15574,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} async (span) => { try { const object = await this.__fromJsonLd__PropertyValue__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -13645,15 +15599,14 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -13673,71 +15626,82 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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"]); + + 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))[] = []; + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = + []; + + let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = + values["https://www.w3.org/ns/activitystreams#name"]; - let _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array = values["https://www.w3.org/ns/activitystreams#name"]; - for ( const v of _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array == null ? [] - : _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array.length === 1 && "@list" in _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name__array[0] + : _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 - ; + + 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); - } - instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = []; + instance.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = + _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name; + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value: ((string | LanguageString))[] = + []; + + let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = + values["http://schema.org#value"]; - let _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array = values["http://schema.org#value"]; - for ( const v of _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array == null ? [] - : _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array.length === 1 && "@list" in _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value__array[0] + : _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 - ; + + 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); - } - instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; - + instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = + _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -13750,9 +15714,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } return instance; } - - protected _getCustomInspectProxy(): Record { - + + protected _getCustomInspectProxy(): Record { const proxy: Record = {}; if (this.id != null) { proxy.id = { @@ -13767,52 +15730,58 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ): 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 + + const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this + .#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name + // 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 (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { - proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; - } - - const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value - // 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 (_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length == 1) { + proxy.name = _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name[0]; + } + + const _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this + .#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value + // 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 (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { - proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; - } - + [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 (_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length == 1) { + proxy.value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value[0]; + } + return proxy; } // @ts-ignore: suppressing TS4127 - [Symbol.for("Deno.customInspect")]( + [Symbol.for("Deno.customInspect")]( inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { @@ -13821,7 +15790,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } // @ts-ignore: suppressing TS4127 - [Symbol.for("nodejs.util.inspect.custom")]( + [Symbol.for("nodejs.util.inspect.custom")]( _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, @@ -13829,61 +15798,59 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} const proxy = this._getCustomInspectProxy(); return "PropertyValue " + inspect(proxy, options); } - } +} /** Means of communicating or interacting with the DID subject or associated * entities via one or more service endpoints. Examples include discovery * services, agent services, social networking services, file storage services, - * and verifiable credential repository services. - * + * and verifiable credential repository services. */ export class DidService { + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; - 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 _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - - /** - * The type URI of {@link DidService}: `https://www.w3.org/ns/did#Service`. - */ - static get typeId(): URL { - return new URL("https://www.w3.org/ns/did#Service"); - } + /** + * The type URI of {@link DidService}: `https://www.w3.org/ns/did#Service`. + */ + static get typeId(): URL { + return new URL("https://www.w3.org/ns/did#Service"); + } #_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint: (URL)[] = []; /** @@ -13892,19 +15859,17 @@ export class DidService { * @param options The options to use for initialization. */ constructor( - values: - { -id?: URL | null; -endpoint?: URL | null; -endpoints?: (URL)[];} -, + values: { + id?: URL | null; + endpoint?: URL | null; + endpoints?: (URL)[]; + }, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; @@ -13920,41 +15885,44 @@ endpoints?: (URL)[];} } else { throw new TypeError("The id must be a URL."); } - - if ("endpoint" in values && values.endpoint != null) { - if (values.endpoint instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = [values.endpoint]; - } else { - throw new TypeError( - "The endpoint must be of type " + - "URL" + ".", - ); - } - } - - if ("endpoints" in values && values.endpoints != null) { - - if ("endpoint" in values && - values.endpoint != null) { - throw new TypeError( - "Cannot initialize both endpoint and " + - "endpoints at the same time.", - ); - } - - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints; - } else { - throw new TypeError( - "The endpoints must be an array of type " + - "URL" + ".", - ); - } - } + + if ("endpoint" in values && values.endpoint != null) { + if (values.endpoint instanceof URL) { + // @ts-ignore: type is checked above. + this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = [values.endpoint]; + } else { + throw new TypeError( + "The endpoint must be of type " + + "URL" + ".", + ); + } + } + + if ("endpoints" in values && values.endpoints != null) { + if ( + "endpoint" in values && + values.endpoint != null + ) { + throw new TypeError( + "Cannot initialize both endpoint and " + + "endpoints at the same time.", + ); + } + + if ( + Array.isArray(values.endpoints) && + values.endpoints.every((v) => v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints; + } else { + throw new TypeError( + "The endpoints must be an array of type " + + "URL" + ".", + ); } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -13962,94 +15930,98 @@ endpoints?: (URL)[];} * @options The options to use for cloning. * @returns The cloned instance. */ - clone( - values: - { -id?: URL | null; -endpoint?: URL | null; -endpoints?: (URL)[];} - - = {}, + clone( + values: { + id?: URL | null; + endpoint?: URL | null; + endpoints?: (URL)[]; + } = {}, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): DidService { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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: DidService = new this.constructor( { id: values.id ?? this.id }, - options - ); - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; - if ("endpoint" in values && values.endpoint != null) { - if (values.endpoint instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = [values.endpoint]; - } else { - throw new TypeError( - "The endpoint must be of type " + - "URL" + ".", - ); - } - } - - if ("endpoints" in values && values.endpoints != null) { - - if ("endpoint" in values && - values.endpoint != null) { - throw new TypeError( - "Cannot update both endpoint and " + - "endpoints at the same time.", - ); - } - - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints; - } else { - throw new TypeError( - "The endpoints must be an array of type " + - "URL" + ".", - ); - } - } - - return clone; - } - -/** A network address, such as an HTTP URL, at which services operate on behalf - * of a DID subject. - * - */ - get endpoint(): (URL | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < 1) return null; - return this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[0]; + options, + ); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = + this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + if ("endpoint" in values && values.endpoint != null) { + if (values.endpoint instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = [ + values.endpoint, + ]; + } else { + throw new TypeError( + "The endpoint must be of type " + + "URL" + ".", + ); } - -/** A network address, such as an HTTP URL, at which services operate on behalf - * of a DID subject. - * - */ -get endpoints(): (URL)[] { - return this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + } + + if ("endpoints" in values && values.endpoints != null) { + if ( + "endpoint" in values && + values.endpoint != null + ) { + throw new TypeError( + "Cannot update both endpoint and " + + "endpoints at the same time.", + ); + } + + if ( + Array.isArray(values.endpoints) && + values.endpoints.every((v) => v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints; + } else { + throw new TypeError( + "The endpoints must be an array of type " + + "URL" + ".", + ); } - + } + + return clone; + } + + /** A network address, such as an HTTP URL, at which services operate on behalf + * of a DID subject. + */ + get endpoint(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < 1) { + return null; + } + return this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[0]; + } + + /** A network address, such as an HTTP URL, at which services operate on behalf + * of a DID subject. + */ + get endpoints(): (URL)[] { + return this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -14060,10 +16032,13 @@ get endpoints(): (URL)[] { 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)[], + async toJsonLd(options: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -14071,32 +16046,27 @@ get endpoints(): (URL)[] { 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'." + "to 'compact'.", ); } options = { ...options, contextLoader: options.contextLoader ?? getDocumentLoader(), }; - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + const values: Record = {}; array = []; for (const v of this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { - const element = ( - { "@id": v.href } - ); - array.push(element);; + const element = { "@id": v.href }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/did#serviceEndpoint"] = propValue; - } - + values["@type"] = ["https://www.w3.org/ns/did#Service"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -14114,16 +16084,14 @@ get endpoints(): (URL)[] { ); if (docContext != null) { // Embed context - } return compacted; } - protected isCompactable(): boolean { - + protected isCompactable(): boolean { return true; } - + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -14135,12 +16103,12 @@ get endpoints(): (URL)[] { * @returns The object of this type. * @throws {TypeError} If the given `json` is invalid. */ - static async fromJsonLd( + static async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -14153,7 +16121,10 @@ get endpoints(): (URL)[] { async (span) => { try { const object = await this.__fromJsonLd__DidService__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -14175,15 +16146,14 @@ get endpoints(): (URL)[] { json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -14203,42 +16173,46 @@ get endpoints(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://w3id.org/fep/9091#Export")) { - return await Export.fromJsonLd(json, options); + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); } - - if (!values["@type"].includes("https://www.w3.org/ns/did#Service")) { - throw new TypeError("Invalid type: " + values["@type"]); + if ( + "@type" in values && + !values["@type"].every((t) => t.startsWith("_:")) + ) { + if (values["@type"].includes("https://w3id.org/fep/9091#Export")) { + return await Export.fromJsonLd(json, options); + } + + if (!values["@type"].includes("https://www.w3.org/ns/did#Service")) { + throw new TypeError("Invalid type: " + values["@type"]); + } } - } - + const instance = new this( { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, options, ); const _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint: (URL)[] = []; - let _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array = values["https://www.w3.org/ns/did#serviceEndpoint"]; - + let _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array = + values["https://www.w3.org/ns/did#serviceEndpoint"]; + for ( const v of _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array == null ? [] - : _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array.length === 1 && "@list" in _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array[0] + : _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array.length === 1 && + "@list" in _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array[0] ? _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array[0]["@list"] : _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint__array ) { if (v == null) continue; - _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.push(new URL(v["@id"])) + _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.push(new URL(v["@id"])); } - instance.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; - + instance.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = + _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -14251,9 +16225,8 @@ get endpoints(): (URL)[] { } return instance; } - - protected _getCustomInspectProxy(): Record { - + + protected _getCustomInspectProxy(): Record { const proxy: Record = {}; if (this.id != null) { proxy.id = { @@ -14268,38 +16241,43 @@ get endpoints(): (URL)[] { ): string => "URL " + inspect(this.id!.href, options), }; } - - const _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + + const _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this + .#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint + // 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 (_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length == 1) { - proxy.endpoint = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[0]; - } - - if (_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length > 1 - || !("endpoint" in proxy) - && _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length > 0) { - proxy.endpoints = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; - } - + [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 (_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length == 1) { + proxy.endpoint = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[0]; + } + + if ( + _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length > 1 || + !("endpoint" in proxy) && + _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length > 0 + ) { + proxy.endpoints = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + } + return proxy; } // @ts-ignore: suppressing TS4127 - [Symbol.for("Deno.customInspect")]( + [Symbol.for("Deno.customInspect")]( inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { @@ -14308,7 +16286,7 @@ get endpoints(): (URL)[] { } // @ts-ignore: suppressing TS4127 - [Symbol.for("nodejs.util.inspect.custom")]( + [Symbol.for("nodejs.util.inspect.custom")]( _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, @@ -14316,39 +16294,37 @@ get endpoints(): (URL)[] { const proxy = this._getCustomInspectProxy(); return "DidService " + inspect(proxy, options); } - } +} /** "Export Actor" service. - * */ export class Export extends DidService { + /** + * The type URI of {@link Export}: `https://w3id.org/fep/9091#Export`. + */ + static override get typeId(): URL { + return new URL("https://w3id.org/fep/9091#Export"); + } - /** - * The type URI of {@link Export}: `https://w3id.org/fep/9091#Export`. - */ - static override get typeId(): URL { - return new URL("https://w3id.org/fep/9091#Export"); - } - /** * Constructs a new instance of Export 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; -endpoint?: URL | null; -endpoints?: (URL)[];} -, + values: { + id?: URL | null; + endpoint?: URL | null; + endpoints?: (URL)[]; + }, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - super(values, options);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -14357,30 +16333,28 @@ endpoints?: (URL)[];} * @returns The cloned instance. */ override clone( - values: - { -id?: URL | null; -endpoint?: URL | null; -endpoints?: (URL)[];} - - = {}, + values: { + id?: URL | null; + endpoint?: URL | null; + endpoints?: (URL)[]; + } = {}, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): Export { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Export; + const clone = super.clone(values, options) as unknown as Export; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -14392,9 +16366,12 @@ endpoints?: (URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -14402,17 +16379,17 @@ endpoints?: (URL)[];} 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'." + "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", @@ -14422,7 +16399,7 @@ endpoints?: (URL)[];} string, unknown[] | { "@list": unknown[] } | string >; - + values["@type"] = ["https://w3id.org/fep/9091#Export"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -14440,16 +16417,14 @@ endpoints?: (URL)[];} ); if (docContext != null) { // Embed context - } 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. @@ -14464,9 +16439,9 @@ endpoints?: (URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -14479,7 +16454,10 @@ endpoints?: (URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Export__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -14501,15 +16479,14 @@ endpoints?: (URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -14529,18 +16506,19 @@ endpoints?: (URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://w3id.org/fep/9091#Export")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://w3id.org/fep/9091#Export")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -14550,7 +16528,7 @@ endpoints?: (URL)[];} if (!(instance instanceof Export)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -14563,9 +16541,9 @@ endpoints?: (URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -14587,64 +16565,68 @@ endpoints?: (URL)[];} const proxy = this._getCustomInspectProxy(); return "Export " + inspect(proxy, options); } - } +} /** A proof that can be added to any activity or object, allowing recipients to * verify the identity of the actor and the integrity of the data. - * */ export class DataIntegrityProof { + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; - 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 _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - - /** - * The type URI of {@link DataIntegrityProof}: `https://w3id.org/security#DataIntegrityProof`. - */ - static get typeId(): URL { - return new URL("https://w3id.org/security#DataIntegrityProof"); - } + /** + * The type URI of {@link DataIntegrityProof}: `https://w3id.org/security#DataIntegrityProof`. + */ + static get typeId(): URL { + return new URL("https://w3id.org/security#DataIntegrityProof"); + } #_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: ("eddsa-jcs-2022")[] = []; -#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; -#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: ("assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement")[] = []; -#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue: (Uint8Array)[] = []; -#_3qzP3ukEZoUziK5FEiA1RhU4aqac: (Temporal.Instant)[] = []; + #_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; + #_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: ( + | "assertionMethod" + | "authentication" + | "capabilityInvocation" + | "capabilityDelegation" + | "keyAgreement" + )[] = []; + #_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue: (Uint8Array)[] = []; + #_3qzP3ukEZoUziK5FEiA1RhU4aqac: (Temporal.Instant)[] = []; /** * Constructs a new instance of DataIntegrityProof with the given values. @@ -14652,18 +16634,26 @@ export class DataIntegrityProof { * @param options The options to use for initialization. */ constructor( - values: - { -id?: URL | null; -cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null;proofPurpose?: "assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement" | null;proofValue?: Uint8Array | null;created?: Temporal.Instant | null;} -, + values: { + id?: URL | null; + cryptosuite?: "eddsa-jcs-2022" | null; + verificationMethod?: Multikey | URL | null; + proofPurpose?: + | "assertionMethod" + | "authentication" + | "capabilityInvocation" + | "capabilityDelegation" + | "keyAgreement" + | null; + proofValue?: Uint8Array | null; + created?: Temporal.Instant | null; + }, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; @@ -14679,69 +16669,81 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null } else { throw new TypeError("The id must be a URL."); } - - if ("cryptosuite" in values && values.cryptosuite != null) { - if (values.cryptosuite == "eddsa-jcs-2022") { - // @ts-ignore: type is checked above. - this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = [values.cryptosuite]; - } else { - throw new TypeError( - "The cryptosuite must be of type " + - "\"eddsa-jcs-2022\"" + ".", - ); - } - } - - if ("verificationMethod" in values && values.verificationMethod != null) { - if (values.verificationMethod instanceof Multikey || values.verificationMethod instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [values.verificationMethod]; - } else { - throw new TypeError( - "The verificationMethod must be of type " + - "Multikey | URL" + ".", - ); - } - } - - if ("proofPurpose" in values && values.proofPurpose != null) { - if (values.proofPurpose === "assertionMethod" || values.proofPurpose === "authentication" || - values.proofPurpose === "capabilityInvocation" || values.proofPurpose === "capabilityDelegation" || - values.proofPurpose === "keyAgreement") { - // @ts-ignore: type is checked above. - this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = [values.proofPurpose]; - } else { - throw new TypeError( - "The proofPurpose must be of type " + - "\"assertionMethod\" | \"authentication\" | \"capabilityInvocation\" | \"capabilityDelegation\" | \"keyAgreement\"" + ".", - ); - } - } - - if ("proofValue" in values && values.proofValue != null) { - if (values.proofValue instanceof Uint8Array) { - // @ts-ignore: type is checked above. - this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue]; - } else { - throw new TypeError( - "The proofValue must be of type " + - "Uint8Array" + ".", - ); - } - } - - if ("created" in values && values.created != null) { - if (values.created instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created]; - } else { - throw new TypeError( - "The created must be of type " + - "Temporal.Instant" + ".", - ); - } - } + + if ("cryptosuite" in values && values.cryptosuite != null) { + if (values.cryptosuite == "eddsa-jcs-2022") { + // @ts-ignore: type is checked above. + this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = [values.cryptosuite]; + } else { + throw new TypeError( + "The cryptosuite must be of type " + + '"eddsa-jcs-2022"' + ".", + ); } + } + + if ("verificationMethod" in values && values.verificationMethod != null) { + if ( + values.verificationMethod instanceof Multikey || + values.verificationMethod instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [ + values.verificationMethod, + ]; + } else { + throw new TypeError( + "The verificationMethod must be of type " + + "Multikey | URL" + ".", + ); + } + } + + if ("proofPurpose" in values && values.proofPurpose != null) { + if ( + values.proofPurpose === "assertionMethod" || + values.proofPurpose === "authentication" || + values.proofPurpose === "capabilityInvocation" || + values.proofPurpose === "capabilityDelegation" || + values.proofPurpose === "keyAgreement" + ) { + // @ts-ignore: type is checked above. + this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = [ + values.proofPurpose, + ]; + } else { + throw new TypeError( + "The proofPurpose must be of type " + + '"assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement"' + + ".", + ); + } + } + + if ("proofValue" in values && values.proofValue != null) { + if (values.proofValue instanceof Uint8Array) { + // @ts-ignore: type is checked above. + this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue]; + } else { + throw new TypeError( + "The proofValue must be of type " + + "Uint8Array" + ".", + ); + } + } + + if ("created" in values && values.created != null) { + if (values.created instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created]; + } else { + throw new TypeError( + "The created must be of type " + + "Temporal.Instant" + ".", + ); + } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -14749,132 +16751,157 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null * @options The options to use for cloning. * @returns The cloned instance. */ - clone( - values: - { -id?: URL | null; -cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null;proofPurpose?: "assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement" | null;proofValue?: Uint8Array | null;created?: Temporal.Instant | null;} - - = {}, + clone( + values: { + id?: URL | null; + cryptosuite?: "eddsa-jcs-2022" | null; + verificationMethod?: Multikey | URL | null; + proofPurpose?: + | "assertionMethod" + | "authentication" + | "capabilityInvocation" + | "capabilityDelegation" + | "keyAgreement" + | null; + proofValue?: Uint8Array | null; + created?: Temporal.Instant | null; + } = {}, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): DataIntegrityProof { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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: DataIntegrityProof = new this.constructor( { id: values.id ?? this.id }, - options - ); - clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; - if ("cryptosuite" in values && values.cryptosuite != null) { - if (values.cryptosuite == "eddsa-jcs-2022") { - // @ts-ignore: type is checked above. - clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = [values.cryptosuite]; - } else { - throw new TypeError( - "The cryptosuite must be of type " + - "\"eddsa-jcs-2022\"" + ".", - ); - } - } - clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; - if ("verificationMethod" in values && values.verificationMethod != null) { - if (values.verificationMethod instanceof Multikey || values.verificationMethod instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [values.verificationMethod]; - } else { - throw new TypeError( - "The verificationMethod must be of type " + - "Multikey | URL" + ".", - ); - } - } - clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose; - if ("proofPurpose" in values && values.proofPurpose != null) { - if (values.proofPurpose === "assertionMethod" || values.proofPurpose === "authentication" || - values.proofPurpose === "capabilityInvocation" || values.proofPurpose === "capabilityDelegation" || - values.proofPurpose === "keyAgreement") { - // @ts-ignore: type is checked above. - clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = [values.proofPurpose]; - } else { - throw new TypeError( - "The proofPurpose must be of type " + - "\"assertionMethod\" | \"authentication\" | \"capabilityInvocation\" | \"capabilityDelegation\" | \"keyAgreement\"" + ".", - ); - } - } - clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; - if ("proofValue" in values && values.proofValue != null) { - if (values.proofValue instanceof Uint8Array) { - // @ts-ignore: type is checked above. - clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue]; - } else { - throw new TypeError( - "The proofValue must be of type " + - "Uint8Array" + ".", - ); - } - } - clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac; - if ("created" in values && values.created != null) { - if (values.created instanceof Temporal.Instant) { - // @ts-ignore: type is checked above. - clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created]; - } else { - throw new TypeError( - "The created must be of type " + - "Temporal.Instant" + ".", - ); - } - } - + options, + ); + clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = + this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; + if ("cryptosuite" in values && values.cryptosuite != null) { + if (values.cryptosuite == "eddsa-jcs-2022") { + // @ts-ignore: type is checked above. + clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = [values.cryptosuite]; + } else { + throw new TypeError( + "The cryptosuite must be of type " + + '"eddsa-jcs-2022"' + ".", + ); + } + } + clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = + this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; + if ("verificationMethod" in values && values.verificationMethod != null) { + if ( + values.verificationMethod instanceof Multikey || + values.verificationMethod instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [ + values.verificationMethod, + ]; + } else { + throw new TypeError( + "The verificationMethod must be of type " + + "Multikey | URL" + ".", + ); + } + } + clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = + this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose; + if ("proofPurpose" in values && values.proofPurpose != null) { + if ( + values.proofPurpose === "assertionMethod" || + values.proofPurpose === "authentication" || + values.proofPurpose === "capabilityInvocation" || + values.proofPurpose === "capabilityDelegation" || + values.proofPurpose === "keyAgreement" + ) { + // @ts-ignore: type is checked above. + clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = [ + values.proofPurpose, + ]; + } else { + throw new TypeError( + "The proofPurpose must be of type " + + '"assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement"' + + ".", + ); + } + } + clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = + this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; + if ("proofValue" in values && values.proofValue != null) { + if (values.proofValue instanceof Uint8Array) { + // @ts-ignore: type is checked above. + clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue]; + } else { + throw new TypeError( + "The proofValue must be of type " + + "Uint8Array" + ".", + ); + } + } + clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac; + if ("created" in values && values.created != null) { + if (values.created instanceof Temporal.Instant) { + // @ts-ignore: type is checked above. + clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created]; + } else { + throw new TypeError( + "The created must be of type " + + "Temporal.Instant" + ".", + ); + } + } + return clone; } - -/** The cryptographic suite used to create the proof. - * - */ - get cryptosuite(): ("eddsa-jcs-2022" | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < 1) return null; - return this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite[0]; - } - - async #fetchVerificationMethod( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + /** The cryptographic suite used to create the proof. + */ + get cryptosuite(): "eddsa-jcs-2022" | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < 1) return null; + return this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite[0]; + } + + async #fetchVerificationMethod( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -14887,7 +16914,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -14897,20 +16924,20 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null try { const obj = await this.#verificationMethod_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -14922,137 +16949,148 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null } finally { span.end(); } - }); + }, + ); + } + + async #verificationMethod_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Multikey.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #verificationMethod_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Multikey.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://w3id.org/security#Multikey"].join(", ")); - } - - - /** - * Similar to - * {@link DataIntegrityProof.getVerificationMethod}, - * but returns its `@id` URL instead of the object itself. - */ - get verificationMethodId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < 1) return null; - const v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** A key owned by an actor according to [FEP-521a: Representing actor's public - * keys][1]. - * - * [1]: https://w3id.org/fep/521a - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://w3id.org/security#Multikey"].join(", "), + ); + } + + /** + * Similar to + * {@link DataIntegrityProof.getVerificationMethod}, + * but returns its `@id` URL instead of the object itself. + */ + get verificationMethodId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < 1) { + return null; + } + const v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** A key owned by an actor according to [FEP-521a: Representing actor's public + * keys][1]. + * + * [1]: https://w3id.org/fep/521a + */ + + async getVerificationMethod( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < 1) { + return null; + } + const v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; + if (v instanceof URL) { + const fetched = await this.#fetchVerificationMethod(v, options); + if (fetched == null) return null; + this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + return v; + } + + /** The reason the proof was created. + * + * - `"assertionMethod"` + * - `"authentication"` + * - `"capabilityInvocation"` + * - `"capabilityDelegation"` + * - `"keyAgreement"` + */ + get proofPurpose(): + | "assertionMethod" + | "authentication" + | "capabilityInvocation" + | "capabilityDelegation" + | "keyAgreement" + | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length < 1) { + return null; + } + return this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose[0]; + } + + /** The proof value. + */ + get proofValue(): Uint8Array | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length < 1) return null; + return this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[0]; + } + + /** The date and time the proof was created. + */ + get created(): Temporal.Instant | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.length < 1) return null; + return this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac[0]; + } - async getVerificationMethod( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < 1) return null; - const v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchVerificationMethod(v, options); - if (fetched == null) return null; - this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - return v; - } - -/** The reason the proof was created. - * - * - `"assertionMethod"` - * - `"authentication"` - * - `"capabilityInvocation"` - * - `"capabilityDelegation"` - * - `"keyAgreement"` - * - */ - get proofPurpose(): ("assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement" | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length < 1) return null; - return this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose[0]; - } - -/** The proof value. - */ - get proofValue(): (Uint8Array | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length < 1) return null; - return this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[0]; - } - -/** The date and time the proof was created. - */ - get created(): (Temporal.Instant | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.length < 1) return null; - return this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac[0]; - } - /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -15063,10 +17101,13 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null 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)[], + async toJsonLd(options: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -15074,100 +17115,77 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null 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'." + "to 'compact'.", ); } options = { ...options, contextLoader: options.contextLoader ?? getDocumentLoader(), }; - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + const values: Record = {}; array = []; for (const v of this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#cryptosuite"] = propValue; - } - + array = []; for (const v of this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#verificationMethod"] = propValue; - } - + array = []; for (const v of this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { - const element = ( - { + const element = { "@id": "https://w3id.org/security#" + v, - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#proofPurpose"] = propValue; - } - + array = []; for (const v of this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { - const element = ( - { + const element = { "@type": "https://w3id.org/security#multibase", "@value": new TextDecoder().decode(encodeMultibase("base58btc", v)), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#proofValue"] = propValue; - } - + array = []; for (const v of this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", "@value": v.toString(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://purl.org/dc/terms/created"] = propValue; - } - + values["@type"] = ["https://w3id.org/security#DataIntegrityProof"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -15185,16 +17203,14 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null ); if (docContext != null) { // Embed context - } return compacted; } - protected isCompactable(): boolean { - + protected isCompactable(): boolean { return true; } - + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -15206,12 +17222,12 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null * @returns The object of this type. * @throws {TypeError} If the given `json` is invalid. */ - static async fromJsonLd( + static async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -15224,7 +17240,10 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null async (span) => { try { const object = await this.__fromJsonLd__DataIntegrityProof__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -15246,15 +17265,14 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -15274,113 +17292,149 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://w3id.org/security#DataIntegrityProof")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://w3id.org/security#DataIntegrityProof", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + const instance = new this( { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, options, ); const _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: ("eddsa-jcs-2022")[] = []; - let _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array = values["https://w3id.org/security#cryptosuite"]; - + let _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array = + values["https://w3id.org/security#cryptosuite"]; + for ( const v of _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array == null ? [] - : _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array.length === 1 && "@list" in _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array[0] + : _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array.length === 1 && + "@list" in _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array[0] ? _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array[0]["@list"] : _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite__array ) { if (v == null) continue; - _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.push(v["@value"]) + _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.push(v["@value"]); } - instance.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; - const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; + instance.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = + _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; + const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = + []; + + let _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array = + values["https://w3id.org/security#verificationMethod"]; - let _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array = values["https://w3id.org/security#verificationMethod"]; - for ( const v of _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array == null ? [] - : _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array.length === 1 && "@list" in _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array[0] + : _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array.length === + 1 && + "@list" in + _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array[0] ? _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array[0]["@list"] : _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.push(await Multikey.fromJsonLd( - v, options)) + _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.push( + await Multikey.fromJsonLd( + v, + options, + ), + ); } - instance.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; - const _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: ("assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement")[] = []; + instance.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = + _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; + const _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: ( + | "assertionMethod" + | "authentication" + | "capabilityInvocation" + | "capabilityDelegation" + | "keyAgreement" + )[] = []; + + let _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array = + values["https://w3id.org/security#proofPurpose"]; - let _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array = values["https://w3id.org/security#proofPurpose"]; - for ( const v of _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array == null ? [] - : _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array.length === 1 && "@list" in _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array[0] + : _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array.length === 1 && + "@list" in _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array[0] ? _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array[0]["@list"] : _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose__array ) { if (v == null) continue; - _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.push(v["@id"].substring(26)) + _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.push(v["@id"].substring(26)); } - instance.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose; + instance.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = + _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose; const _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue: (Uint8Array)[] = []; - let _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array = values["https://w3id.org/security#proofValue"]; - + let _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array = + values["https://w3id.org/security#proofValue"]; + for ( const v of _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array == null ? [] - : _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array.length === 1 && "@list" in _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array[0] + : _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array.length === 1 && + "@list" in _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array[0] ? _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array[0]["@list"] : _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue__array ) { if (v == null) continue; - _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.push(decodeMultibase(v["@value"])) + _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.push( + decodeMultibase(v["@value"]), + ); } - instance.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; + instance.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = + _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; const _3qzP3ukEZoUziK5FEiA1RhU4aqac: (Temporal.Instant)[] = []; - let _3qzP3ukEZoUziK5FEiA1RhU4aqac__array = values["http://purl.org/dc/terms/created"]; - + let _3qzP3ukEZoUziK5FEiA1RhU4aqac__array = + values["http://purl.org/dc/terms/created"]; + for ( const v of _3qzP3ukEZoUziK5FEiA1RhU4aqac__array == null ? [] - : _3qzP3ukEZoUziK5FEiA1RhU4aqac__array.length === 1 && "@list" in _3qzP3ukEZoUziK5FEiA1RhU4aqac__array[0] + : _3qzP3ukEZoUziK5FEiA1RhU4aqac__array.length === 1 && + "@list" in _3qzP3ukEZoUziK5FEiA1RhU4aqac__array[0] ? _3qzP3ukEZoUziK5FEiA1RhU4aqac__array[0]["@list"] : _3qzP3ukEZoUziK5FEiA1RhU4aqac__array ) { if (v == null) continue; - _3qzP3ukEZoUziK5FEiA1RhU4aqac.push(Temporal.Instant.from( + _3qzP3ukEZoUziK5FEiA1RhU4aqac.push(Temporal.Instant.from( v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] - : v["@value"] + "Z" - )) + : v["@value"] + "Z", + )); } instance.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = _3qzP3ukEZoUziK5FEiA1RhU4aqac; - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -15393,9 +17447,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null } return instance; } - - protected _getCustomInspectProxy(): Record { - + + protected _getCustomInspectProxy(): Record { const proxy: Record = {}; if (this.id != null) { proxy.id = { @@ -15410,112 +17463,127 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null ): string => "URL " + inspect(this.id!.href, options), }; } - - const _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + + const _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this + .#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite + // 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 (_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length == 1) { - proxy.cryptosuite = _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite[0]; - } - - const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod - // 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 (_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length == 1) { + proxy.cryptosuite = _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite[0]; + } + + const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this + .#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod + // 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 (_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length == 1) { - proxy.verificationMethod = _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; - } - - const _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose - // 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 (_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length == 1) { + proxy.verificationMethod = + _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; + } + + const _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this + .#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose + // 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 (_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length == 1) { - proxy.proofPurpose = _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose[0]; - } - - const _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue - // 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 (_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length == 1) { + proxy.proofPurpose = _2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose[0]; + } + + const _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this + .#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue + // 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 (_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length == 1) { - proxy.proofValue = _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[0]; - } - - const _3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac - // 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 (_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length == 1) { + proxy.proofValue = _3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[0]; + } + + const _3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac + // 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 (_3qzP3ukEZoUziK5FEiA1RhU4aqac.length == 1) { - proxy.created = _3qzP3ukEZoUziK5FEiA1RhU4aqac[0]; - } - + [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 (_3qzP3ukEZoUziK5FEiA1RhU4aqac.length == 1) { + proxy.created = _3qzP3ukEZoUziK5FEiA1RhU4aqac[0]; + } + return proxy; } // @ts-ignore: suppressing TS4127 - [Symbol.for("Deno.customInspect")]( + [Symbol.for("Deno.customInspect")]( inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { @@ -15524,7 +17592,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null } // @ts-ignore: suppressing TS4127 - [Symbol.for("nodejs.util.inspect.custom")]( + [Symbol.for("nodejs.util.inspect.custom")]( _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, @@ -15532,59 +17600,59 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null const proxy = this._getCustomInspectProxy(); return "DataIntegrityProof " + inspect(proxy, options); } - } +} /** A key owned by an actor. */ export class CryptographicKey { + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; - 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 _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - - /** - * The type URI of {@link CryptographicKey}: `https://w3id.org/security#Key`. - */ - static get typeId(): URL { - return new URL("https://w3id.org/security#Key"); - } - #_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; -#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem: (CryptoKey)[] = []; + /** + * The type URI of {@link CryptographicKey}: `https://w3id.org/security#Key`. + */ + static get typeId(): URL { + return new URL("https://w3id.org/security#Key"); + } + #_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: + (Application | Group | Organization | Person | Service | URL)[] = []; + #_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem: (CryptoKey)[] = []; /** * Constructs a new instance of CryptographicKey with the given values. @@ -15592,18 +17660,24 @@ export class CryptographicKey { * @param options The options to use for initialization. */ constructor( - values: - { -id?: URL | null; -owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} -, + values: { + id?: URL | null; + owner?: + | Application + | Group + | Organization + | Person + | Service + | URL + | null; + publicKey?: CryptoKey | null; + }, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; @@ -15619,34 +17693,39 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } else { throw new TypeError("The id must be a URL."); } - - if ("owner" in values && values.owner != null) { - if (values.owner instanceof Application || values.owner instanceof Group || values.owner instanceof Organization || values.owner instanceof Person || values.owner instanceof Service || values.owner instanceof URL) { - // @ts-ignore: type is checked above. - this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; - } else { - throw new TypeError( - "The owner must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("publicKey" in values && values.publicKey != null) { - if ( + + if ("owner" in values && values.owner != null) { + if ( + values.owner instanceof Application || values.owner instanceof Group || + values.owner instanceof Organization || + values.owner instanceof Person || values.owner instanceof Service || + values.owner instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; + } else { + throw new TypeError( + "The owner must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("publicKey" in values && values.publicKey != null) { + if ( // @ts-ignore: CryptoKey exists in the global scope. values.publicKey instanceof CryptoKey ) { - // @ts-ignore: type is checked above. - this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = [values.publicKey]; - } else { - throw new TypeError( - "The publicKey must be of type " + - "CryptoKey" + ".", - ); - } - } + // @ts-ignore: type is checked above. + this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = [values.publicKey]; + } else { + throw new TypeError( + "The publicKey must be of type " + + "CryptoKey" + ".", + ); } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -15654,83 +17733,98 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * @options The options to use for cloning. * @returns The cloned instance. */ - clone( - values: - { -id?: URL | null; -owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} - - = {}, + clone( + values: { + id?: URL | null; + owner?: + | Application + | Group + | Organization + | Person + | Service + | URL + | null; + publicKey?: CryptoKey | null; + } = {}, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): CryptographicKey { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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: CryptographicKey = new this.constructor( { id: values.id ?? this.id }, - options - ); - clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; - if ("owner" in values && values.owner != null) { - if (values.owner instanceof Application || values.owner instanceof Group || values.owner instanceof Organization || values.owner instanceof Person || values.owner instanceof Service || values.owner instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; - } else { - throw new TypeError( - "The owner must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; - if ("publicKey" in values && values.publicKey != null) { - if ( + options, + ); + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = + this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; + if ("owner" in values && values.owner != null) { + if ( + values.owner instanceof Application || values.owner instanceof Group || + values.owner instanceof Organization || + values.owner instanceof Person || values.owner instanceof Service || + values.owner instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; + } else { + throw new TypeError( + "The owner must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = + this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; + if ("publicKey" in values && values.publicKey != null) { + if ( // @ts-ignore: CryptoKey exists in the global scope. values.publicKey instanceof CryptoKey ) { - // @ts-ignore: type is checked above. - clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = [values.publicKey]; - } else { - throw new TypeError( - "The publicKey must be of type " + - "CryptoKey" + ".", - ); - } - } - + // @ts-ignore: type is checked above. + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = [values.publicKey]; + } else { + throw new TypeError( + "The publicKey must be of type " + + "CryptoKey" + ".", + ); + } + } + return clone; } - - async #fetchOwner( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + async #fetchOwner( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -15743,7 +17837,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -15753,20 +17847,20 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi try { const obj = await this.#owner_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -15778,150 +17872,160 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } finally { span.end(); } - }); + }, + ); + } + + async #owner_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #owner_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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 CryptographicKey.getOwner}, - * but returns its `@id` URL instead of the object itself. - */ - get ownerId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < 1) return null; - const v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** An actor who owns this key. - */ + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - async getOwner( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < 1) return null; - const v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchOwner(v, options); - if (fetched == null) return null; - this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "owner" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "owner"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#owner_fromJsonLd(obj, options); - } - } - - return v; - } - -/** A PEM-encoded public key. - */ - get publicKey(): (CryptoKey | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length < 1) return null; - return this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem[0]; + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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 CryptographicKey.getOwner}, + * but returns its `@id` URL instead of the object itself. + */ + get ownerId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < 1) return null; + const v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** An actor who owns this key. + */ + + async getOwner( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < 1) return null; + const v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; + if (v instanceof URL) { + const fetched = await this.#fetchOwner(v, options); + if (fetched == null) return null; + this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "owner" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "owner" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#owner_fromJsonLd(obj, options); } - + } + + return v; + } + + /** A PEM-encoded public key. + */ + get publicKey(): CryptoKey | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length < 1) { + return null; + } + return this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem[0]; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -15932,10 +18036,13 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi 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)[], + async toJsonLd(options: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -15943,110 +18050,110 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi 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'." + "to 'compact'.", ); } options = { ...options, contextLoader: options.contextLoader ?? getDocumentLoader(), }; - + if (options.format == null && this.isCompactable()) { - const result: Record = {}; + const result: Record = {}; // deno-lint-ignore no-unused-vars let compactItems: unknown[]; - + compactItems = []; for (const v of this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { - 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, - }) - ); + 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["owner"] - = compactItems.length > 1 + result["owner"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { - const item = ( - await exportSpki(v) - ); + const item = await exportSpki(v); compactItems.push(item); } if (compactItems.length > 0) { - - result["publicKeyPem"] - = compactItems.length > 1 + result["publicKeyPem"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + result["type"] = "CryptographicKey"; if (this.id != null) result["id"] = this.id.href; result["@context"] = "https://w3id.org/security/v1"; return result; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + const values: Record = {}; array = []; for (const v of this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { - 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);; + 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 - ); + const propValue = array; values["https://w3id.org/security#owner"] = propValue; - } - + array = []; for (const v of this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { - const element = ( - { "@value": await exportSpki(v) } - ); - array.push(element);; + const element = { "@value": await exportSpki(v) }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#publicKeyPem"] = propValue; - } - + values["@type"] = ["https://w3id.org/security#Key"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -16064,16 +18171,14 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi ); if (docContext != null) { // Embed context - } return compacted; } - protected isCompactable(): boolean { - + protected isCompactable(): boolean { return true; } - + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -16085,12 +18190,12 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * @returns The object of this type. * @throws {TypeError} If the given `json` is invalid. */ - static async fromJsonLd( + static async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -16103,7 +18208,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi async (span) => { try { const object = await this.__fromJsonLd__CryptographicKey__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -16125,15 +18233,14 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -16153,79 +18260,117 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://w3id.org/security#Key")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://w3id.org/security#Key")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + const instance = new this( { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, options, ); - const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; + const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: + (Application | Group | Organization | Person | Service | URL)[] = []; + + let _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array = + values["https://w3id.org/security#owner"]; - let _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array = values["https://w3id.org/security#owner"]; - for ( const v of _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array == null ? [] - : _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array.length === 1 && "@list" in _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array[0] + : _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array.length === 1 && + "@list" in _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array[0] ? _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array[0]["@list"] : _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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) : 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) : 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) : 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) : 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) : undefined - ; + + 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : undefined; if (typeof decoded === "undefined") continue; _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.push(decoded); - } - instance.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; + instance.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = + _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; const _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem: (CryptoKey)[] = []; - let _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array = values["https://w3id.org/security#publicKeyPem"]; - + let _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array = + values["https://w3id.org/security#publicKeyPem"]; + for ( const v of _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array == null ? [] - : _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array.length === 1 && "@list" in _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array[0] + : _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array.length === 1 && + "@list" in _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array[0] ? _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array[0]["@list"] : _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array ) { if (v == null) continue; - _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.push(await importPem(v["@value"])) + _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.push( + await importPem(v["@value"]), + ); } - instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; - + instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = + _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -16238,9 +18383,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } return instance; } - - protected _getCustomInspectProxy(): Record { - + + protected _getCustomInspectProxy(): Record { const proxy: Record = {}; if (this.id != null) { proxy.id = { @@ -16255,52 +18399,58 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi ): string => "URL " + inspect(this.id!.href, options), }; } - - const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + + const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this + .#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner + // 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 (_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length == 1) { - proxy.owner = _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; - } - - const _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem - // 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 (_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length == 1) { + proxy.owner = _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; + } + + const _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this + .#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem + // 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 (_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length == 1) { - proxy.publicKey = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem[0]; - } - + [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 (_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length == 1) { + proxy.publicKey = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem[0]; + } + return proxy; } // @ts-ignore: suppressing TS4127 - [Symbol.for("Deno.customInspect")]( + [Symbol.for("Deno.customInspect")]( inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { @@ -16309,7 +18459,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } // @ts-ignore: suppressing TS4127 - [Symbol.for("nodejs.util.inspect.custom")]( + [Symbol.for("nodejs.util.inspect.custom")]( _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, @@ -16317,63 +18467,62 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi const proxy = this._getCustomInspectProxy(); return "CryptographicKey " + inspect(proxy, options); } - } +} /** Represents a key owned by an actor according to [FEP-521a: Representing * actor's public keys.][1] - * + * * [1]: https://w3id.org/fep/521a - * */ export class Multikey { + readonly #documentLoader?: DocumentLoader; + readonly #contextLoader?: DocumentLoader; + readonly #tracerProvider?: TracerProvider; + readonly #warning?: { + category: string[]; + message: string; + values?: Record; + }; + #cachedJsonLd?: unknown; + readonly id: URL | null; - 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 _documentLoader(): DocumentLoader | undefined { - return this.#documentLoader; - } + protected get _contextLoader(): DocumentLoader | undefined { + return this.#contextLoader; + } - protected get _contextLoader(): DocumentLoader | undefined { - return this.#contextLoader; - } + protected get _tracerProvider(): TracerProvider | undefined { + return this.#tracerProvider; + } - protected get _tracerProvider(): TracerProvider | undefined { - return this.#tracerProvider; - } + protected get _warning(): { + category: string[]; + message: string; + values?: Record; + } | undefined { + return this.#warning; + } - protected get _warning(): { - category: string[]; - message: string; - values?: Record; - } | undefined { - return this.#warning; - } + protected get _cachedJsonLd(): unknown | undefined { + return this.#cachedJsonLd; + } - protected get _cachedJsonLd(): unknown | undefined { - return this.#cachedJsonLd; - } + protected set _cachedJsonLd(value: unknown | undefined) { + this.#cachedJsonLd = value; + } - protected set _cachedJsonLd(value: unknown | undefined) { - this.#cachedJsonLd = value; - } - - /** - * The type URI of {@link Multikey}: `https://w3id.org/security#Multikey`. - */ - static get typeId(): URL { - return new URL("https://w3id.org/security#Multikey"); - } - #_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; -#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase: (CryptoKey)[] = []; + /** + * The type URI of {@link Multikey}: `https://w3id.org/security#Multikey`. + */ + static get typeId(): URL { + return new URL("https://w3id.org/security#Multikey"); + } + #_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: + (Application | Group | Organization | Person | Service | URL)[] = []; + #_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase: (CryptoKey)[] = []; /** * Constructs a new instance of Multikey with the given values. @@ -16381,18 +18530,24 @@ export class Multikey { * @param options The options to use for initialization. */ constructor( - values: - { -id?: URL | null; -controller?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} -, + values: { + id?: URL | null; + controller?: + | Application + | Group + | Organization + | Person + | Service + | URL + | null; + publicKey?: CryptoKey | null; + }, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; @@ -16408,34 +18563,42 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } else { throw new TypeError("The id must be a URL."); } - - if ("controller" in values && values.controller != null) { - if (values.controller instanceof Application || values.controller instanceof Group || values.controller instanceof Organization || values.controller instanceof Person || values.controller instanceof Service || values.controller instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; - } else { - throw new TypeError( - "The controller must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("publicKey" in values && values.publicKey != null) { - if ( + + if ("controller" in values && values.controller != null) { + if ( + values.controller instanceof Application || + values.controller instanceof Group || + values.controller instanceof Organization || + values.controller instanceof Person || + values.controller instanceof Service || values.controller instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; + } else { + throw new TypeError( + "The controller must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("publicKey" in values && values.publicKey != null) { + if ( // @ts-ignore: CryptoKey exists in the global scope. values.publicKey instanceof CryptoKey ) { - // @ts-ignore: type is checked above. - this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = [values.publicKey]; - } else { - throw new TypeError( - "The publicKey must be of type " + - "CryptoKey" + ".", - ); - } - } + // @ts-ignore: type is checked above. + this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = [ + values.publicKey, + ]; + } else { + throw new TypeError( + "The publicKey must be of type " + + "CryptoKey" + ".", + ); } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -16443,83 +18606,101 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * @options The options to use for cloning. * @returns The cloned instance. */ - clone( - values: - { -id?: URL | null; -controller?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} - - = {}, + clone( + values: { + id?: URL | null; + controller?: + | Application + | Group + | Organization + | Person + | Service + | URL + | null; + publicKey?: CryptoKey | null; + } = {}, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): Multikey { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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: Multikey = new this.constructor( { id: values.id ?? this.id }, - options - ); - clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; - if ("controller" in values && values.controller != null) { - if (values.controller instanceof Application || values.controller instanceof Group || values.controller instanceof Organization || values.controller instanceof Person || values.controller instanceof Service || values.controller instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; - } else { - throw new TypeError( - "The controller must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; - if ("publicKey" in values && values.publicKey != null) { - if ( + options, + ); + clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = + this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; + if ("controller" in values && values.controller != null) { + if ( + values.controller instanceof Application || + values.controller instanceof Group || + values.controller instanceof Organization || + values.controller instanceof Person || + values.controller instanceof Service || values.controller instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; + } else { + throw new TypeError( + "The controller must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = + this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; + if ("publicKey" in values && values.publicKey != null) { + if ( // @ts-ignore: CryptoKey exists in the global scope. values.publicKey instanceof CryptoKey ) { - // @ts-ignore: type is checked above. - clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = [values.publicKey]; - } else { - throw new TypeError( - "The publicKey must be of type " + - "CryptoKey" + ".", - ); - } - } - + // @ts-ignore: type is checked above. + clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = [ + values.publicKey, + ]; + } else { + throw new TypeError( + "The publicKey must be of type " + + "CryptoKey" + ".", + ); + } + } + return clone; } - - async #fetchController( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + async #fetchController( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -16532,7 +18713,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -16542,20 +18723,20 @@ controller?: Application | Group | Organization | Person | Service | URL | null; try { const obj = await this.#controller_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -16567,154 +18748,163 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } finally { span.end(); } - }); + }, + ); + } + + async #controller_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #controller_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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 Multikey.getController}, - * but returns its `@id` URL instead of the object itself. - */ - get controllerId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < 1) return null; - const v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** An actor who owns this key. - */ + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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 Multikey.getController}, + * but returns its `@id` URL instead of the object itself. + */ + get controllerId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < 1) return null; + const v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** An actor who owns this key. + */ - async getController( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < 1) return null; - const v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchController(v, options); - if (fetched == null) return null; - this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "controller" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "controller"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#controller_fromJsonLd(obj, options); - } - } - - return v; - } - -/** A [Multibase]-encoded value of a [Multicodec] prefix and the key. - * - * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0 - * [Multicodec]: https://github.com/multiformats/multicodec/ - * - */ - get publicKey(): (CryptoKey | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length < 1) return null; - return this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase[0]; + async getController( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < 1) return null; + const v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; + if (v instanceof URL) { + const fetched = await this.#fetchController(v, options); + if (fetched == null) return null; + this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "controller" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "controller" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#controller_fromJsonLd(obj, options); } - + } + + return v; + } + + /** A [Multibase]-encoded value of a [Multicodec] prefix and the key. + * + * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0 + * [Multicodec]: https://github.com/multiformats/multicodec/ + */ + get publicKey(): CryptoKey | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length < 1) { + return null; + } + return this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase[0]; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -16725,10 +18915,13 @@ controller?: Application | Group | Organization | Person | Service | URL | null; 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)[], + async toJsonLd(options: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -16736,113 +18929,113 @@ controller?: Application | Group | Organization | Person | Service | URL | null; 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'." + "to 'compact'.", ); } options = { ...options, contextLoader: options.contextLoader ?? getDocumentLoader(), }; - + if (options.format == null && this.isCompactable()) { - const result: Record = {}; + const result: Record = {}; // deno-lint-ignore no-unused-vars let compactItems: unknown[]; - + compactItems = []; for (const v of this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { - 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, - }) - ); + 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["controller"] - = compactItems.length > 1 + result["controller"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { - const item = ( - await exportMultibaseKey(v) - ); + const item = await exportMultibaseKey(v); compactItems.push(item); } if (compactItems.length > 0) { - - result["publicKeyMultibase"] - = compactItems.length > 1 + result["publicKeyMultibase"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + result["type"] = "Multikey"; if (this.id != null) result["id"] = this.id.href; result["@context"] = "https://w3id.org/security/multikey/v1"; return result; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - const values: Record = {}; + const values: Record = {}; array = []; for (const v of this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { - 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);; + 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 - ); + const propValue = array; values["https://w3id.org/security#controller"] = propValue; - } - + array = []; for (const v of this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { - const element = ( - { + const element = { "@type": "https://w3id.org/security#multibase", "@value": await exportMultibaseKey(v), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#publicKeyMultibase"] = propValue; - } - + values["@type"] = ["https://w3id.org/security#Multikey"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -16860,16 +19053,14 @@ controller?: Application | Group | Organization | Person | Service | URL | null; ); if (docContext != null) { // Embed context - } return compacted; } - protected isCompactable(): boolean { - + protected isCompactable(): boolean { return true; } - + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -16881,12 +19072,12 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * @returns The object of this type. * @throws {TypeError} If the given `json` is invalid. */ - static async fromJsonLd( + static async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -16899,7 +19090,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; async (span) => { try { const object = await this.__fromJsonLd__Multikey__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -16921,15 +19115,14 @@ controller?: Application | Group | Organization | Person | Service | URL | null; json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -16949,79 +19142,119 @@ controller?: Application | Group | Organization | Person | Service | URL | null; // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://w3id.org/security#Multikey")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://w3id.org/security#Multikey")) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + const instance = new this( { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, options, ); - const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; + const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: + (Application | Group | Organization | Person | Service | URL)[] = []; + + let _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array = + values["https://w3id.org/security#controller"]; - let _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array = values["https://w3id.org/security#controller"]; - for ( const v of _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array == null ? [] - : _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array.length === 1 && "@list" in _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array[0] + : _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array.length === 1 && + "@list" in _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array[0] ? _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array[0]["@list"] : _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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) : 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) : 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) : 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) : 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) : undefined - ; + + 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : undefined; if (typeof decoded === "undefined") continue; _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.push(decoded); - } - instance.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; + instance.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = + _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; const _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase: (CryptoKey)[] = []; - let _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array = values["https://w3id.org/security#publicKeyMultibase"]; - + let _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array = + values["https://w3id.org/security#publicKeyMultibase"]; + for ( const v of _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array == null ? [] - : _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array.length === 1 && "@list" in _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array[0] + : _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array.length === + 1 && + "@list" in + _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array[0] ? _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array[0]["@list"] : _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase__array ) { if (v == null) continue; - _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.push(await importMultibaseKey(v["@value"])) + _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.push( + await importMultibaseKey(v["@value"]), + ); } - instance.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; - + instance.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = + _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -17034,9 +19267,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } return instance; } - - protected _getCustomInspectProxy(): Record { - + + protected _getCustomInspectProxy(): Record { const proxy: Record = {}; if (this.id != null) { proxy.id = { @@ -17051,52 +19283,58 @@ controller?: Application | Group | Organization | Person | Service | URL | null; ): string => "URL " + inspect(this.id!.href, options), }; } - - const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + + const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this + .#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller + // 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 (_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length == 1) { - proxy.controller = _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; - } - - const _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase - // 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 (_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length == 1) { + proxy.controller = _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; + } + + const _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this + .#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase + // 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 (_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length == 1) { - proxy.publicKey = _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase[0]; - } - + [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 (_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length == 1) { + proxy.publicKey = _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase[0]; + } + return proxy; } // @ts-ignore: suppressing TS4127 - [Symbol.for("Deno.customInspect")]( + [Symbol.for("Deno.customInspect")]( inspect: typeof Deno.inspect, options: Deno.InspectOptions, ): string { @@ -17105,7 +19343,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } // @ts-ignore: suppressing TS4127 - [Symbol.for("nodejs.util.inspect.custom")]( + [Symbol.for("nodejs.util.inspect.custom")]( _depth: number, options: unknown, inspect: (value: unknown, options: unknown) => string, @@ -17113,62 +19351,112 @@ controller?: Application | Group | Organization | Person | Service | URL | null; const proxy = this._getCustomInspectProxy(); return "Multikey " + inspect(proxy, options); } - } +} /** Indicates that the `actor` accepts the `object`. The `target` property can be * used in certain circumstances to indicate the context into which the `object` * has been accepted. - * */ export class Accept extends Activity { + /** + * The type URI of {@link Accept}: `https://www.w3.org/ns/activitystreams#Accept`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Accept"); + } - /** - * The type URI of {@link Accept}: `https://www.w3.org/ns/activitystreams#Accept`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Accept"); - } - /** * Constructs a new instance of Accept 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, + 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);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -17177,51 +19465,101 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): Accept { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Accept; + const clone = super.clone(values, options) as unknown as Accept; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -17233,9 +19571,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -17243,17 +19584,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -17263,7 +19604,7 @@ instruments?: (Object | URL)[];} string, unknown[] | { "@list": unknown[] } | string >; - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Accept"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -17273,7 +19614,11 @@ 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", + ]; const compacted = await jsonld.compact( values, docContext, @@ -17281,27 +19626,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -17316,9 +19661,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -17331,7 +19676,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Accept__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -17353,15 +19701,14 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -17381,22 +19728,31 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://www.w3.org/ns/activitystreams#TentativeAccept")) { - return await TentativeAccept.fromJsonLd(json, options); + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); } - - if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Accept")) { - throw new TypeError("Invalid type: " + values["@type"]); + if ( + "@type" in values && + !values["@type"].every((t) => t.startsWith("_:")) + ) { + 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#Accept", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } } - } - + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -17406,7 +19762,7 @@ instruments?: (Object | URL)[];} if (!(instance instanceof Accept)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -17419,9 +19775,9 @@ instruments?: (Object | URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -17443,63 +19799,113 @@ instruments?: (Object | URL)[];} const proxy = this._getCustomInspectProxy(); return "Accept " + inspect(proxy, options); } - } +} /** Indicates that the `actor` has added the `object` to the `target`. * If the `target` property is not explicitly specified, the target would need * to be determined implicitly by context. The `origin` can be used to identify * the context from which the `object` originated. - * */ export class Add extends Activity { + /** + * The type URI of {@link Add}: `https://www.w3.org/ns/activitystreams#Add`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Add"); + } - /** - * The type URI of {@link Add}: `https://www.w3.org/ns/activitystreams#Add`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Add"); - } - /** * Constructs a new instance of Add 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, + 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);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -17508,51 +19914,101 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): Add { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Add; + const clone = super.clone(values, options) as unknown as Add; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -17564,9 +20020,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -17574,17 +20033,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -17594,7 +20053,7 @@ instruments?: (Object | URL)[];} string, unknown[] | { "@list": unknown[] } | string >; - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Add"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -17604,7 +20063,11 @@ 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", + ]; const compacted = await jsonld.compact( values, docContext, @@ -17612,27 +20075,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -17647,9 +20110,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -17662,7 +20125,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Add__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -17684,15 +20150,14 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -17712,18 +20177,21 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://www.w3.org/ns/activitystreams#Add")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://www.w3.org/ns/activitystreams#Add") + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -17733,7 +20201,7 @@ instruments?: (Object | URL)[];} if (!(instance instanceof Add)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -17746,9 +20214,9 @@ instruments?: (Object | URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -17770,62 +20238,112 @@ instruments?: (Object | URL)[];} const proxy = this._getCustomInspectProxy(); return "Add " + inspect(proxy, options); } - } +} /** Indicates that the `actor` is calling the `target`'s attention the `object`. - * + * * The `origin` typically has no defined meaning. - * */ export class Announce extends Activity { + /** + * The type URI of {@link Announce}: `https://www.w3.org/ns/activitystreams#Announce`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Announce"); + } - /** - * The type URI of {@link Announce}: `https://www.w3.org/ns/activitystreams#Announce`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Announce"); - } - /** * Constructs a new instance of Announce 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, + 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);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -17834,51 +20352,101 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): Announce { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Announce; + const clone = super.clone(values, options) as unknown as Announce; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -17890,9 +20458,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -17900,17 +20471,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -17920,7 +20491,7 @@ instruments?: (Object | URL)[];} string, unknown[] | { "@list": unknown[] } | string >; - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Announce"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -17930,7 +20501,30 @@ 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", + { + "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, @@ -17938,27 +20532,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -17973,9 +20567,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -17988,7 +20582,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Announce__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -18010,1013 +20607,1363 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): 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 ("@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://www.w3.org/ns/activitystreams#Announce", + ) + ) { + 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 Announce)) { + 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; + } + + // @ts-ignore: suppressing TS4127 + override [Symbol.for("Deno.customInspect")]( + inspect: typeof Deno.inspect, + options: Deno.InspectOptions, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Announce " + inspect(proxy, options); + } + + // @ts-ignore: suppressing TS4127 + override [Symbol.for("nodejs.util.inspect.custom")]( + _depth: number, + options: unknown, + inspect: (value: unknown, options: unknown) => string, + ): string { + const proxy = this._getCustomInspectProxy(); + return "Announce " + inspect(proxy, options); + } +} + +/** Describes a software application. + */ +export class Application extends Object { + /** + * The type URI of {@link Application}: `https://www.w3.org/ns/activitystreams#Application`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Application"); + } + #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: + ((string | LanguageString))[] = []; + #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; + #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; + #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; + #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: + (OrderedCollection | OrderedCollectionPage | URL)[] = []; + #_41QwhqJouoLg3h8dRPKat21brynC_outbox: + (OrderedCollection | OrderedCollectionPage | URL)[] = []; + #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; + #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; + #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; + #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; + #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; + #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; + #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; + #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; + #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; + #_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial: (boolean)[] = []; + #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; + #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: + (Application | Group | Organization | Person | Service | URL)[] = []; + #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: + (Application | Group | Organization | Person | Service | URL)[] = []; + #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; + #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; + #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; + + /** + * Constructs a new instance of Application 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)[]; + 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; + aliases?: (Application | Group | Organization | Person | Service | URL)[]; + service?: DidService | URL | null; + services?: (DidService | URL)[]; + followedMessage?: string | null; + cat?: boolean | null; + }, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + } = {}, + ) { + super(values, options); + if ("preferredUsername" in values && values.preferredUsername != null) { + if ( + typeof values.preferredUsername === "string" || + values.preferredUsername instanceof LanguageString + ) { + // @ts-ignore: type is checked above. + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = [ + values.preferredUsername, + ]; + } else { + throw new TypeError( + "The preferredUsername must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("preferredUsernames" in values && values.preferredUsernames != null) { + if ( + "preferredUsername" in values && + values.preferredUsername != null + ) { + throw new TypeError( + "Cannot initialize both preferredUsername and " + + "preferredUsernames at the same time.", + ); + } + + if ( + Array.isArray(values.preferredUsernames) && + values.preferredUsernames.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = + values.preferredUsernames; + } else { + throw new TypeError( + "The preferredUsernames must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("publicKey" in values && values.publicKey != null) { + if ( + values.publicKey instanceof CryptographicKey || + values.publicKey instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; + } else { + throw new TypeError( + "The publicKey must be of type " + + "CryptographicKey | URL" + ".", + ); + } + } + + if ("publicKeys" in values && values.publicKeys != null) { + if ( + "publicKey" in values && + values.publicKey != null + ) { + throw new TypeError( + "Cannot initialize both publicKey and " + + "publicKeys at the same time.", + ); + } + + if ( + Array.isArray(values.publicKeys) && + values.publicKeys.every((v) => + v instanceof CryptographicKey || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys; + } else { + throw new TypeError( + "The publicKeys must be an array of type " + + "CryptographicKey | URL" + ".", + ); + } + } + + if ("assertionMethod" in values && values.assertionMethod != null) { + if ( + values.assertionMethod instanceof Multikey || + values.assertionMethod instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [ + values.assertionMethod, + ]; + } else { + throw new TypeError( + "The assertionMethod must be of type " + + "Multikey | URL" + ".", + ); + } + } + + if ("assertionMethods" in values && values.assertionMethods != null) { + if ( + "assertionMethod" in values && + values.assertionMethod != null + ) { + throw new TypeError( + "Cannot initialize both assertionMethod and " + + "assertionMethods at the same time.", + ); + } + + if ( + Array.isArray(values.assertionMethods) && + values.assertionMethods.every((v) => + v instanceof Multikey || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = + values.assertionMethods; + } else { + throw new TypeError( + "The assertionMethods must be an array of type " + + "Multikey | URL" + ".", + ); + } + } + + if ( + "manuallyApprovesFollowers" in values && + values.manuallyApprovesFollowers != null + ) { + if (typeof values.manuallyApprovesFollowers === "boolean") { + // @ts-ignore: type is checked above. + this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = [ + values.manuallyApprovesFollowers, + ]; + } else { + throw new TypeError( + "The manuallyApprovesFollowers must be of type " + + "boolean" + ".", + ); + } + } + + if ("inbox" in values && values.inbox != null) { + if ( + values.inbox instanceof OrderedCollection || + values.inbox instanceof OrderedCollectionPage || + values.inbox instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; + } else { + throw new TypeError( + "The inbox must be of type " + + "OrderedCollection | OrderedCollectionPage | URL" + ".", + ); + } + } + + if ("outbox" in values && values.outbox != null) { + if ( + values.outbox instanceof OrderedCollection || + values.outbox instanceof OrderedCollectionPage || + values.outbox instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; + } else { + throw new TypeError( + "The outbox must be of type " + + "OrderedCollection | OrderedCollectionPage | URL" + ".", + ); + } + } + + if ("following" in values && values.following != null) { + if ( + values.following instanceof Collection || + values.following instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; + } else { + throw new TypeError( + "The following must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("followers" in values && values.followers != null) { + if ( + values.followers instanceof Collection || + values.followers instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; + } else { + throw new TypeError( + "The followers must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("liked" in values && values.liked != null) { + if (values.liked instanceof Collection || values.liked instanceof URL) { + // @ts-ignore: type is checked above. + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; + } else { + throw new TypeError( + "The liked must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("featured" in values && values.featured != null) { + if ( + values.featured instanceof Collection || values.featured instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; + } else { + throw new TypeError( + "The featured must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("featuredTags" in values && values.featuredTags != null) { + if ( + values.featuredTags instanceof Collection || + values.featuredTags instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [ + values.featuredTags, + ]; + } else { + throw new TypeError( + "The featuredTags must be of type " + + "Collection | URL" + ".", + ); + } + } + + if ("streams" in values && values.streams != null) { + if ( + Array.isArray(values.streams) && + values.streams.every((v) => v instanceof Collection || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams; + } else { + throw new TypeError( + "The streams must be an array of type " + + "Collection | URL" + ".", + ); + } + } + + if ("endpoints" in values && values.endpoints != null) { + if (values.endpoints instanceof Endpoints) { + // @ts-ignore: type is checked above. + this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = [values.endpoints]; + } else { + throw new TypeError( + "The endpoints must be of type " + + "Endpoints" + ".", + ); + } + } + + if ("discoverable" in values && values.discoverable != null) { + if (typeof values.discoverable === "boolean") { + // @ts-ignore: type is checked above. + this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = [values.discoverable]; + } else { + throw new TypeError( + "The discoverable must be of type " + + "boolean" + ".", + ); + } + } + + if ("suspended" in values && values.suspended != null) { + if (typeof values.suspended === "boolean") { + // @ts-ignore: type is checked above. + this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = [values.suspended]; + } else { + throw new TypeError( + "The suspended must be of type " + + "boolean" + ".", + ); + } + } + + if ("memorial" in values && values.memorial != null) { + if (typeof values.memorial === "boolean") { + // @ts-ignore: type is checked above. + this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = [values.memorial]; + } else { + throw new TypeError( + "The memorial must be of type " + + "boolean" + ".", + ); + } + } + + if ("indexable" in values && values.indexable != null) { + if (typeof values.indexable === "boolean") { + // @ts-ignore: type is checked above. + this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = [values.indexable]; + } else { + throw new TypeError( + "The indexable must be of type " + + "boolean" + ".", + ); + } + } + + if ("successor" in values && values.successor != null) { + if ( + values.successor instanceof Application || + values.successor instanceof Group || + values.successor instanceof Organization || + values.successor instanceof Person || + values.successor instanceof Service || values.successor instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; + } else { + throw new TypeError( + "The successor must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("alias" in values && values.alias != null) { + if ( + values.alias instanceof Application || values.alias instanceof Group || + values.alias instanceof Organization || + values.alias instanceof Person || values.alias instanceof Service || + values.alias instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; + } else { + throw new TypeError( + "The alias must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("aliases" in values && values.aliases != null) { + if ( + "alias" in values && + values.alias != null + ) { + throw new TypeError( + "Cannot initialize both alias and " + + "aliases at the same time.", + ); + } + + if ( + Array.isArray(values.aliases) && + values.aliases.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.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases; + } else { + throw new TypeError( + "The aliases must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + + if ("service" in values && values.service != null) { + if ( + values.service instanceof DidService || values.service instanceof URL + ) { + // @ts-ignore: type is checked above. + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; + } else { + throw new TypeError( + "The service must be of type " + + "DidService | URL" + ".", + ); + } + } + + if ("services" in values && values.services != null) { + if ( + "service" in values && + values.service != null + ) { + throw new TypeError( + "Cannot initialize both service and " + + "services at the same time.", + ); + } + + if ( + Array.isArray(values.services) && + values.services.every((v) => + v instanceof DidService || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services; + } else { + throw new TypeError( + "The services must be an array of type " + + "DidService | URL" + ".", + ); + } + } + + if ("followedMessage" in values && values.followedMessage != null) { + if (typeof values.followedMessage === "string") { + // @ts-ignore: type is checked above. + this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = [ + values.followedMessage, + ]; + } else { + throw new TypeError( + "The followedMessage must be of type " + + "string" + ".", + ); + } + } + + if ("cat" in values && values.cat != null) { + if (typeof values.cat === "boolean") { + // @ts-ignore: type is checked above. + this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = [values.cat]; + } else { + throw new TypeError( + "The cat must be of type " + + "boolean" + ".", + ); + } + } + } + + /** + * Clones this instance, optionally updating it with the given values. + * @param values The values to update the clone with. + * @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)[]; + 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; + aliases?: (Application | Group | Organization | Person | Service | URL)[]; + service?: DidService | URL | null; + services?: (DidService | URL)[]; + followedMessage?: string | null; + cat?: boolean | null; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, + ): Application { + 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 Application; + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; + if ("preferredUsername" in values && values.preferredUsername != null) { + if ( + typeof values.preferredUsername === "string" || + values.preferredUsername instanceof LanguageString + ) { + // @ts-ignore: type is checked above. + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = [ + values.preferredUsername, + ]; + } else { + throw new TypeError( + "The preferredUsername must be of type " + + "string | LanguageString" + ".", + ); + } + } + + if ("preferredUsernames" in values && values.preferredUsernames != null) { + if ( + "preferredUsername" in values && + values.preferredUsername != null + ) { + throw new TypeError( + "Cannot update both preferredUsername and " + + "preferredUsernames at the same time.", + ); + } + + if ( + Array.isArray(values.preferredUsernames) && + values.preferredUsernames.every((v) => + typeof v === "string" || v instanceof LanguageString + ) + ) { + // @ts-ignore: type is checked above. + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = + values.preferredUsernames; + } else { + throw new TypeError( + "The preferredUsernames must be an array of type " + + "string | LanguageString" + ".", + ); + } + } + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + if ("publicKey" in values && values.publicKey != null) { + if ( + values.publicKey instanceof CryptographicKey || + values.publicKey instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; + } else { + throw new TypeError( + "The publicKey must be of type " + + "CryptographicKey | URL" + ".", + ); + } + } + + if ("publicKeys" in values && values.publicKeys != null) { + if ( + "publicKey" in values && + values.publicKey != null + ) { + throw new TypeError( + "Cannot update both publicKey and " + + "publicKeys at the same time.", + ); + } + + if ( + Array.isArray(values.publicKeys) && + values.publicKeys.every((v) => + v instanceof CryptographicKey || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys; + } else { + throw new TypeError( + "The publicKeys must be an array of type " + + "CryptographicKey | URL" + ".", + ); + } + } + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + if ("assertionMethod" in values && values.assertionMethod != null) { + if ( + values.assertionMethod instanceof Multikey || + values.assertionMethod instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [ + values.assertionMethod, + ]; + } else { + throw new TypeError( + "The assertionMethod must be of type " + + "Multikey | URL" + ".", + ); + } + } + + if ("assertionMethods" in values && values.assertionMethods != null) { + if ( + "assertionMethod" in values && + values.assertionMethod != null + ) { + throw new TypeError( + "Cannot update both assertionMethod and " + + "assertionMethods at the same time.", + ); + } + + if ( + Array.isArray(values.assertionMethods) && + values.assertionMethods.every((v) => + v instanceof Multikey || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = + values.assertionMethods; + } else { + throw new TypeError( + "The assertionMethods must be an array of type " + + "Multikey | URL" + ".", + ); + } + } + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = + this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; + if ( + "manuallyApprovesFollowers" in values && + values.manuallyApprovesFollowers != null + ) { + if (typeof values.manuallyApprovesFollowers === "boolean") { + // @ts-ignore: type is checked above. + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = [ + values.manuallyApprovesFollowers, + ]; + } else { + throw new TypeError( + "The manuallyApprovesFollowers must be of type " + + "boolean" + ".", + ); + } + } + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + if ("inbox" in values && values.inbox != null) { + if ( + values.inbox instanceof OrderedCollection || + values.inbox instanceof OrderedCollectionPage || + values.inbox instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; + } else { + throw new TypeError( + "The inbox must be of type " + + "OrderedCollection | OrderedCollectionPage | URL" + ".", + ); + } + } + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = + this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + if ("outbox" in values && values.outbox != null) { + if ( + values.outbox instanceof OrderedCollection || + values.outbox instanceof OrderedCollectionPage || + values.outbox instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; + } else { + throw new TypeError( + "The outbox must be of type " + + "OrderedCollection | OrderedCollectionPage | URL" + ".", + ); + } + } + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + if ("following" in values && values.following != null) { + if ( + values.following instanceof Collection || + values.following instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; + } else { + throw new TypeError( + "The following must be of type " + + "Collection | URL" + ".", + ); + } + } + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + if ("followers" in values && values.followers != null) { + if ( + values.followers instanceof Collection || + values.followers instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; + } else { + throw new TypeError( + "The followers must be of type " + + "Collection | URL" + ".", + ); + } } - 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 }); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + if ("liked" in values && values.liked != null) { + if (values.liked instanceof Collection || values.liked instanceof URL) { + // @ts-ignore: type is checked above. + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; + } else { + throw new TypeError( + "The liked must be of type " + + "Collection | URL" + ".", + ); + } } - - 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://www.w3.org/ns/activitystreams#Announce")) { - throw new TypeError("Invalid type: " + values["@type"]); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = + this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + if ("featured" in values && values.featured != null) { + if ( + values.featured instanceof Collection || values.featured instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; + } else { + throw new TypeError( + "The featured must be of type " + + "Collection | URL" + ".", + ); + } } - } - - delete values["@type"]; - const instance = await super.fromJsonLd(values, { - ...options, - // @ts-ignore: an internal option - _fromSubclass: true, - }); - if (!(instance instanceof Announce)) { - throw new TypeError("Unexpected type: " + instance.constructor.name); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = + this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + if ("featuredTags" in values && values.featuredTags != null) { + if ( + values.featuredTags instanceof Collection || + values.featuredTags instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [ + values.featuredTags, + ]; + } else { + throw new TypeError( + "The featuredTags must be of type " + + "Collection | URL" + ".", + ); + } } - - if (!("_fromSubclass" in options) || !options._fromSubclass) { - try { - instance._cachedJsonLd = structuredClone(json); - } catch { - getLogger(["fedify", "vocab"]).warn( - "Failed to cache JSON-LD: {json}", - { json }, + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + if ("streams" in values && values.streams != null) { + if ( + Array.isArray(values.streams) && + values.streams.every((v) => v instanceof Collection || v instanceof URL) + ) { + // @ts-ignore: type is checked above. + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams; + } else { + throw new TypeError( + "The streams must be an array of type " + + "Collection | URL" + ".", + ); + } + } + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = + this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + if ("endpoints" in values && values.endpoints != null) { + if (values.endpoints instanceof Endpoints) { + // @ts-ignore: type is checked above. + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = [values.endpoints]; + } else { + throw new TypeError( + "The endpoints must be of type " + + "Endpoints" + ".", + ); + } + } + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = + this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; + if ("discoverable" in values && values.discoverable != null) { + if (typeof values.discoverable === "boolean") { + // @ts-ignore: type is checked above. + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = [ + values.discoverable, + ]; + } else { + throw new TypeError( + "The discoverable must be of type " + + "boolean" + ".", + ); + } + } + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = + this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended; + if ("suspended" in values && values.suspended != null) { + if (typeof values.suspended === "boolean") { + // @ts-ignore: type is checked above. + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = [values.suspended]; + } else { + throw new TypeError( + "The suspended must be of type " + + "boolean" + ".", + ); + } + } + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = + this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial; + if ("memorial" in values && values.memorial != null) { + if (typeof values.memorial === "boolean") { + // @ts-ignore: type is checked above. + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = [values.memorial]; + } else { + throw new TypeError( + "The memorial must be of type " + + "boolean" + ".", + ); + } + } + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = + this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; + if ("indexable" in values && values.indexable != null) { + if (typeof values.indexable === "boolean") { + // @ts-ignore: type is checked above. + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = [values.indexable]; + } else { + throw new TypeError( + "The indexable must be of type " + + "boolean" + ".", + ); + } + } + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = + this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + if ("successor" in values && values.successor != null) { + if ( + values.successor instanceof Application || + values.successor instanceof Group || + values.successor instanceof Organization || + values.successor instanceof Person || + values.successor instanceof Service || values.successor instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; + } else { + throw new TypeError( + "The successor must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + if ("alias" in values && values.alias != null) { + if ( + values.alias instanceof Application || values.alias instanceof Group || + values.alias instanceof Organization || + values.alias instanceof Person || values.alias instanceof Service || + values.alias instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; + } else { + throw new TypeError( + "The alias must be of type " + + "Application | Group | Organization | Person | Service | URL" + ".", ); } } - return instance; - } - - protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); - return proxy; - } - - // @ts-ignore: suppressing TS4127 - override [Symbol.for("Deno.customInspect")]( - inspect: typeof Deno.inspect, - options: Deno.InspectOptions, - ): string { - const proxy = this._getCustomInspectProxy(); - return "Announce " + inspect(proxy, options); - } - // @ts-ignore: suppressing TS4127 - override [Symbol.for("nodejs.util.inspect.custom")]( - _depth: number, - options: unknown, - inspect: (value: unknown, options: unknown) => string, - ): string { - const proxy = this._getCustomInspectProxy(); - return "Announce " + inspect(proxy, options); - } - } + if ("aliases" in values && values.aliases != null) { + if ( + "alias" in values && + values.alias != null + ) { + throw new TypeError( + "Cannot update both alias and " + + "aliases at the same time.", + ); + } -/** Describes a software application. - */ -export class Application extends Object { + if ( + Array.isArray(values.aliases) && + values.aliases.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.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases; + } else { + throw new TypeError( + "The aliases must be an array of type " + + "Application | Group | Organization | Person | Service | URL" + ".", + ); + } + } + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + if ("service" in values && values.service != null) { + if ( + values.service instanceof DidService || values.service instanceof URL + ) { + // @ts-ignore: type is checked above. + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; + } else { + throw new TypeError( + "The service must be of type " + + "DidService | URL" + ".", + ); + } + } - /** - * The type URI of {@link Application}: `https://www.w3.org/ns/activitystreams#Application`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Application"); - } - #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; -#_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; -#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; -#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; -#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; -#_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; -#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; -#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; -#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; -#_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; -#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; -#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; -#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; -#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; -#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; -#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial: (boolean)[] = []; -#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; -#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; -#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; -#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; -#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; -#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; + if ("services" in values && values.services != null) { + if ( + "service" in values && + values.service != null + ) { + throw new TypeError( + "Cannot update both service and " + + "services at the same time.", + ); + } - /** - * Constructs a new instance of Application 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)[];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; -aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; -services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } = {}, - ) { - super(values, options); - if ("preferredUsername" in values && values.preferredUsername != null) { - if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { - // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = [values.preferredUsername]; - } else { - throw new TypeError( - "The preferredUsername must be of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("preferredUsernames" in values && values.preferredUsernames != null) { - - if ("preferredUsername" in values && - values.preferredUsername != null) { - throw new TypeError( - "Cannot initialize both preferredUsername and " + - "preferredUsernames at the same time.", - ); - } - - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames; - } else { - throw new TypeError( - "The preferredUsernames must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("publicKey" in values && values.publicKey != null) { - if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { - // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - } else { - throw new TypeError( - "The publicKey must be of type " + - "CryptographicKey | URL" + ".", - ); - } - } - - if ("publicKeys" in values && values.publicKeys != null) { - - if ("publicKey" in values && - values.publicKey != null) { - throw new TypeError( - "Cannot initialize both publicKey and " + - "publicKeys at the same time.", - ); - } - - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys; - } else { - throw new TypeError( - "The publicKeys must be an array of type " + - "CryptographicKey | URL" + ".", - ); - } - } - - if ("assertionMethod" in values && values.assertionMethod != null) { - if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { - // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - } else { - throw new TypeError( - "The assertionMethod must be of type " + - "Multikey | URL" + ".", - ); - } - } - - if ("assertionMethods" in values && values.assertionMethods != null) { - - if ("assertionMethod" in values && - values.assertionMethod != null) { - throw new TypeError( - "Cannot initialize both assertionMethod and " + - "assertionMethods at the same time.", - ); - } - - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods; - } else { - throw new TypeError( - "The assertionMethods must be an array of type " + - "Multikey | URL" + ".", - ); - } - } - - if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { - if (typeof values.manuallyApprovesFollowers === "boolean") { - // @ts-ignore: type is checked above. - this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = [values.manuallyApprovesFollowers]; - } else { - throw new TypeError( - "The manuallyApprovesFollowers must be of type " + - "boolean" + ".", - ); - } - } - - if ("inbox" in values && values.inbox != null) { - if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - } else { - throw new TypeError( - "The inbox must be of type " + - "OrderedCollection | OrderedCollectionPage | URL" + ".", - ); - } - } - - if ("outbox" in values && values.outbox != null) { - if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { - // @ts-ignore: type is checked above. - this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - } else { - throw new TypeError( - "The outbox must be of type " + - "OrderedCollection | OrderedCollectionPage | URL" + ".", - ); - } - } - - if ("following" in values && values.following != null) { - if (values.following instanceof Collection || values.following instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - } else { - throw new TypeError( - "The following must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("followers" in values && values.followers != null) { - if (values.followers instanceof Collection || values.followers instanceof URL) { - // @ts-ignore: type is checked above. - this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - } else { - throw new TypeError( - "The followers must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("liked" in values && values.liked != null) { - if (values.liked instanceof Collection || values.liked instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - } else { - throw new TypeError( - "The liked must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("featured" in values && values.featured != null) { - if (values.featured instanceof Collection || values.featured instanceof URL) { - // @ts-ignore: type is checked above. - this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - } else { - throw new TypeError( - "The featured must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("featuredTags" in values && values.featuredTags != null) { - if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - } else { - throw new TypeError( - "The featuredTags must be of type " + - "Collection | URL" + ".", - ); - } - } - - if ("streams" in values && values.streams != null) { - - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams; - } else { - throw new TypeError( - "The streams must be an array of type " + - "Collection | URL" + ".", - ); - } - } - - if ("endpoints" in values && values.endpoints != null) { - if (values.endpoints instanceof Endpoints) { - // @ts-ignore: type is checked above. - this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = [values.endpoints]; - } else { - throw new TypeError( - "The endpoints must be of type " + - "Endpoints" + ".", - ); - } - } - - if ("discoverable" in values && values.discoverable != null) { - if (typeof values.discoverable === "boolean") { - // @ts-ignore: type is checked above. - this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = [values.discoverable]; - } else { - throw new TypeError( - "The discoverable must be of type " + - "boolean" + ".", - ); - } - } - - if ("suspended" in values && values.suspended != null) { - if (typeof values.suspended === "boolean") { - // @ts-ignore: type is checked above. - this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = [values.suspended]; - } else { - throw new TypeError( - "The suspended must be of type " + - "boolean" + ".", - ); - } - } - - if ("memorial" in values && values.memorial != null) { - if (typeof values.memorial === "boolean") { - // @ts-ignore: type is checked above. - this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = [values.memorial]; - } else { - throw new TypeError( - "The memorial must be of type " + - "boolean" + ".", - ); - } - } - - if ("indexable" in values && values.indexable != null) { - if (typeof values.indexable === "boolean") { - // @ts-ignore: type is checked above. - this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = [values.indexable]; - } else { - throw new TypeError( - "The indexable must be of type " + - "boolean" + ".", - ); - } - } - - if ("successor" in values && values.successor != null) { - if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { - // @ts-ignore: type is checked above. - this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - } else { - throw new TypeError( - "The successor must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("alias" in values && values.alias != null) { - if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { - // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - } else { - throw new TypeError( - "The alias must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("aliases" in values && values.aliases != null) { - - if ("alias" in values && - values.alias != null) { - throw new TypeError( - "Cannot initialize both alias and " + - "aliases at the same time.", - ); - } - - if (Array.isArray(values.aliases) && - values.aliases.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.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases; - } else { - throw new TypeError( - "The aliases must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("service" in values && values.service != null) { - if (values.service instanceof DidService || values.service instanceof URL) { - // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - } else { - throw new TypeError( - "The service must be of type " + - "DidService | URL" + ".", - ); - } - } - - if ("services" in values && values.services != null) { - - if ("service" in values && - values.service != null) { - throw new TypeError( - "Cannot initialize both service and " + - "services at the same time.", - ); - } - - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { - // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services; - } else { - throw new TypeError( - "The services must be an array of type " + - "DidService | URL" + ".", - ); - } - } - - if ("followedMessage" in values && values.followedMessage != null) { - if (typeof values.followedMessage === "string") { - // @ts-ignore: type is checked above. - this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = [values.followedMessage]; - } else { - throw new TypeError( - "The followedMessage must be of type " + - "string" + ".", - ); - } - } - - if ("cat" in values && values.cat != null) { - if (typeof values.cat === "boolean") { - // @ts-ignore: type is checked above. - this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = [values.cat]; - } else { - throw new TypeError( - "The cat must be of type " + - "boolean" + ".", - ); - } - } + if ( + Array.isArray(values.services) && + values.services.every((v) => + v instanceof DidService || v instanceof URL + ) + ) { + // @ts-ignore: type is checked above. + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services; + } else { + throw new TypeError( + "The services must be an array of type " + + "DidService | URL" + ".", + ); + } + } + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = + this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage; + if ("followedMessage" in values && values.followedMessage != null) { + if (typeof values.followedMessage === "string") { + // @ts-ignore: type is checked above. + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = [ + values.followedMessage, + ]; + } else { + throw new TypeError( + "The followedMessage must be of type " + + "string" + ".", + ); + } + } + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = + this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat; + if ("cat" in values && values.cat != null) { + if (typeof values.cat === "boolean") { + // @ts-ignore: type is checked above. + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = [values.cat]; + } else { + throw new TypeError( + "The cat must be of type " + + "boolean" + ".", + ); } + } - /** - * Clones this instance, optionally updating it with the given values. - * @param values The values to update the clone with. - * @options The options to use for cloning. - * @returns The cloned instance. + return clone; + } + + /** A short username which may be used to refer to the actor, + * with no uniqueness guarantees. */ - 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)[];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; -aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; -services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} - ): Application { + get preferredUsername(): string | LanguageString | null { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; - if ("preferredUsername" in values && values.preferredUsername != null) { - if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { - // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = [values.preferredUsername]; - } else { - throw new TypeError( - "The preferredUsername must be of type " + - "string | LanguageString" + ".", - ); - } - } - - if ("preferredUsernames" in values && values.preferredUsernames != null) { - - if ("preferredUsername" in values && - values.preferredUsername != null) { - throw new TypeError( - "Cannot update both preferredUsername and " + - "preferredUsernames at the same time.", - ); - } - - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { - // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames; - } else { - throw new TypeError( - "The preferredUsernames must be an array of type " + - "string | LanguageString" + ".", - ); - } - } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; - if ("publicKey" in values && values.publicKey != null) { - if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - } else { - throw new TypeError( - "The publicKey must be of type " + - "CryptographicKey | URL" + ".", - ); - } - } - - if ("publicKeys" in values && values.publicKeys != null) { - - if ("publicKey" in values && - values.publicKey != null) { - throw new TypeError( - "Cannot update both publicKey and " + - "publicKeys at the same time.", - ); - } - - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys; - } else { - throw new TypeError( - "The publicKeys must be an array of type " + - "CryptographicKey | URL" + ".", - ); - } - } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; - if ("assertionMethod" in values && values.assertionMethod != null) { - if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - } else { - throw new TypeError( - "The assertionMethod must be of type " + - "Multikey | URL" + ".", - ); - } - } - - if ("assertionMethods" in values && values.assertionMethods != null) { - - if ("assertionMethod" in values && - values.assertionMethod != null) { - throw new TypeError( - "Cannot update both assertionMethod and " + - "assertionMethods at the same time.", - ); - } - - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods; - } else { - throw new TypeError( - "The assertionMethods must be an array of type " + - "Multikey | URL" + ".", - ); - } - } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; - if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { - if (typeof values.manuallyApprovesFollowers === "boolean") { - // @ts-ignore: type is checked above. - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = [values.manuallyApprovesFollowers]; - } else { - throw new TypeError( - "The manuallyApprovesFollowers must be of type " + - "boolean" + ".", - ); - } - } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; - if ("inbox" in values && values.inbox != null) { - if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - } else { - throw new TypeError( - "The inbox must be of type " + - "OrderedCollection | OrderedCollectionPage | URL" + ".", - ); - } - } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; - if ("outbox" in values && values.outbox != null) { - if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - } else { - throw new TypeError( - "The outbox must be of type " + - "OrderedCollection | OrderedCollectionPage | URL" + ".", - ); - } - } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; - if ("following" in values && values.following != null) { - if (values.following instanceof Collection || values.following instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - } else { - throw new TypeError( - "The following must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; - if ("followers" in values && values.followers != null) { - if (values.followers instanceof Collection || values.followers instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - } else { - throw new TypeError( - "The followers must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; - if ("liked" in values && values.liked != null) { - if (values.liked instanceof Collection || values.liked instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - } else { - throw new TypeError( - "The liked must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; - if ("featured" in values && values.featured != null) { - if (values.featured instanceof Collection || values.featured instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - } else { - throw new TypeError( - "The featured must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; - if ("featuredTags" in values && values.featuredTags != null) { - if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - } else { - throw new TypeError( - "The featuredTags must be of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; - if ("streams" in values && values.streams != null) { - - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams; - } else { - throw new TypeError( - "The streams must be an array of type " + - "Collection | URL" + ".", - ); - } - } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; - if ("endpoints" in values && values.endpoints != null) { - if (values.endpoints instanceof Endpoints) { - // @ts-ignore: type is checked above. - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = [values.endpoints]; - } else { - throw new TypeError( - "The endpoints must be of type " + - "Endpoints" + ".", - ); - } - } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; - if ("discoverable" in values && values.discoverable != null) { - if (typeof values.discoverable === "boolean") { - // @ts-ignore: type is checked above. - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = [values.discoverable]; - } else { - throw new TypeError( - "The discoverable must be of type " + - "boolean" + ".", - ); - } - } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended; - if ("suspended" in values && values.suspended != null) { - if (typeof values.suspended === "boolean") { - // @ts-ignore: type is checked above. - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = [values.suspended]; - } else { - throw new TypeError( - "The suspended must be of type " + - "boolean" + ".", - ); - } - } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial; - if ("memorial" in values && values.memorial != null) { - if (typeof values.memorial === "boolean") { - // @ts-ignore: type is checked above. - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = [values.memorial]; - } else { - throw new TypeError( - "The memorial must be of type " + - "boolean" + ".", - ); - } - } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; - if ("indexable" in values && values.indexable != null) { - if (typeof values.indexable === "boolean") { - // @ts-ignore: type is checked above. - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = [values.indexable]; - } else { - throw new TypeError( - "The indexable must be of type " + - "boolean" + ".", - ); - } - } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; - if ("successor" in values && values.successor != null) { - if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - } else { - throw new TypeError( - "The successor must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; - if ("alias" in values && values.alias != null) { - if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - } else { - throw new TypeError( - "The alias must be of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - - if ("aliases" in values && values.aliases != null) { - - if ("alias" in values && - values.alias != null) { - throw new TypeError( - "Cannot update both alias and " + - "aliases at the same time.", - ); - } - - if (Array.isArray(values.aliases) && - values.aliases.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.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases; - } else { - throw new TypeError( - "The aliases must be an array of type " + - "Application | Group | Organization | Person | Service | URL" + ".", - ); - } - } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; - if ("service" in values && values.service != null) { - if (values.service instanceof DidService || values.service instanceof URL) { - // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - } else { - throw new TypeError( - "The service must be of type " + - "DidService | URL" + ".", - ); - } - } - - if ("services" in values && values.services != null) { - - if ("service" in values && - values.service != null) { - throw new TypeError( - "Cannot update both service and " + - "services at the same time.", - ); - } - - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { - // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services; - } else { - throw new TypeError( - "The services must be an array of type " + - "DidService | URL" + ".", - ); - } - } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage; - if ("followedMessage" in values && values.followedMessage != null) { - if (typeof values.followedMessage === "string") { - // @ts-ignore: type is checked above. - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = [values.followedMessage]; - } else { - throw new TypeError( - "The followedMessage must be of type " + - "string" + ".", - ); - } - } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat; - if ("cat" in values && values.cat != null) { - if (typeof values.cat === "boolean") { - // @ts-ignore: type is checked above. - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = [values.cat]; - } else { - throw new TypeError( - "The cat must be of type " + - "boolean" + ".", - ); - } - } - - return clone; + if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1) { + return null; + } + return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername[0]; } - -/** A short username which may be used to refer to the actor, - * with no uniqueness guarantees. - * - */ - get preferredUsername(): (string | LanguageString | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < 1) return null; - return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername[0]; - } - -/** A short username which may be used to refer to the actor, - * with no uniqueness guarantees. - * - */ -get preferredUsernames(): ((string | LanguageString))[] { - return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; - } - - async #fetchPublicKey( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + /** A short username which may be used to refer to the actor, + * with no uniqueness guarantees. + */ + get preferredUsernames(): ((string | LanguageString))[] { + return this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; + } + + async #fetchPublicKey( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -19029,7 +21976,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -19039,20 +21986,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#publicKey_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -19064,188 +22011,194 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #publicKey_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await CryptographicKey.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #publicKey_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await CryptographicKey.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://w3id.org/security#Key"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getPublicKey}, - * but returns its `@id` URL instead of the object itself. - */ - get publicKeyId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < 1) return null; - const v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; - if (v instanceof URL) return v; - return v.id; + throw new TypeError( + "Expected an object of any type of: " + + ["https://w3id.org/security#Key"].join(", "), + ); + } + + /** + * Similar to + * {@link Application.getPublicKey}, + * but returns its `@id` URL instead of the object itself. + */ + get publicKeyId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < 1) return null; + const v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** A public part of the key pair owned by this actor. + */ + + async getPublicKey( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < 1) return null; + const v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; + if (v instanceof URL) { + const fetched = await this.#fetchPublicKey(v, options); + if (fetched == null) return null; + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "publicKey" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "publicKey" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#publicKey_fromJsonLd(obj, options); } - -/** A public part of the key pair owned by this actor. - */ + } - async getPublicKey( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < 1) return null; - const v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchPublicKey(v, options); - if (fetched == null) return null; - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "publicKey" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "publicKey"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#publicKey_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Application.getPublicKeys}, - * but returns their `@id`s instead of the objects themselves. - */ - get publicKeyIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + return v; + } + + /** + * Similar to + * {@link Application.getPublicKeys}, + * but returns their `@id`s instead of the objects themselves. + */ + get publicKeyIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** A public part of the key pair owned by this actor. + */ + + async *getPublicKeys( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchPublicKey( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** A public part of the key pair owned by this actor. - */ - async* getPublicKeys( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchPublicKey( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "publicKey" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "publicKey"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#publicKey_fromJsonLd(obj, options); - continue; - } - } - - yield v; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "publicKey" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "publicKey" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#publicKey_fromJsonLd(obj, options); + continue; } } - - async #fetchAssertionMethod( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchAssertionMethod( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -19258,7 +22211,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -19268,20 +22221,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#assertionMethod_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -19293,215 +22246,224 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #assertionMethod_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Multikey.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #assertionMethod_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Multikey.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://w3id.org/security#Multikey"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getAssertionMethod}, - * but returns its `@id` URL instead of the object itself. - */ - get assertionMethodId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < 1) return null; - const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Represents this actor's public keys. It serves as equivalent to - * the `publicKeys` property, but is used for [FEP-521a] compliance. - * - * [FEP-521a]: https://w3id.org/fep/521a - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://w3id.org/security#Multikey"].join(", "), + ); + } - async getAssertionMethod( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < 1) return null; - const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchAssertionMethod(v, options); - if (fetched == null) return null; - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "assertionMethod" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "assertionMethod"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#assertionMethod_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Application.getAssertionMethods}, - * but returns their `@id`s instead of the objects themselves. - */ - get assertionMethodIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** Represents this actor's public keys. It serves as equivalent to - * the `publicKeys` property, but is used for [FEP-521a] compliance. - * - * [FEP-521a]: https://w3id.org/fep/521a - * - */ + /** + * Similar to + * {@link Application.getAssertionMethod}, + * but returns its `@id` URL instead of the object itself. + */ + get assertionMethodId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < 1) { + return null; + } + const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Represents this actor's public keys. It serves as equivalent to + * the `publicKeys` property, but is used for [FEP-521a] compliance. + * + * [FEP-521a]: https://w3id.org/fep/521a + */ + + async getAssertionMethod( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < 1) { + return null; + } + const v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; + if (v instanceof URL) { + const fetched = await this.#fetchAssertionMethod(v, options); + if (fetched == null) return null; + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "assertionMethod" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "assertionMethod" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#assertionMethod_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Application.getAssertionMethods}, + * but returns their `@id`s instead of the objects themselves. + */ + get assertionMethodIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Represents this actor's public keys. It serves as equivalent to + * the `publicKeys` property, but is used for [FEP-521a] compliance. + * + * [FEP-521a]: https://w3id.org/fep/521a + */ + + async *getAssertionMethods( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchAssertionMethod( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } - async* getAssertionMethods( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchAssertionMethod( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "assertionMethod" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "assertionMethod"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#assertionMethod_fromJsonLd(obj, options); - continue; - } - } - - yield v; + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "assertionMethod" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "assertionMethod" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#assertionMethod_fromJsonLd(obj, options); + continue; } } - -/** When `true`, conveys that for this actor, follow requests are not usually - * automatically approved, but instead are examined by a person who may accept - * or reject the request, at some time in the future. Setting of `false` - * conveys no information and may be ignored. This information is typically - * used to affect display of accounts, such as showing an account as private or - * locked. - * - */ - get manuallyApprovesFollowers(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < 1) return null; - return this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers[0]; - } - - async #fetchInbox( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + /** When `true`, conveys that for this actor, follow requests are not usually + * automatically approved, but instead are examined by a person who may accept + * or reject the request, at some time in the future. Setting of `false` + * conveys no information and may be ignored. This information is typically + * used to affect display of accounts, such as showing an account as private or + * locked. + */ + get manuallyApprovesFollowers(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if ( + this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < 1 + ) return null; + return this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers[0]; + } + + async #fetchInbox( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -19514,7 +22476,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -19524,20 +22486,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#inbox_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -19549,143 +22511,149 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #inbox_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await OrderedCollection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await OrderedCollectionPage.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError( + "Expected an object of any type of: " + + [ + "https://www.w3.org/ns/activitystreams#OrderedCollection", + "https://www.w3.org/ns/activitystreams#OrderedCollectionPage", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Application.getInbox}, + * but returns its `@id` URL instead of the object itself. + */ + get inboxId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < 1) return null; + const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** The inbox stream contains all activities received by the actor. The server + * SHOULD filter content according to the requester's permission. In general, + * the owner of an inbox is likely to be able to access all of their inbox + * contents. Depending on access control, some other content may be public, + * whereas other content may require authentication for non-owner users, + * if they can access the inbox at all. + * + * The server MUST perform de-duplication of activities returned by the inbox. + * Duplication can occur if an activity is addressed both to an actor's + * followers, and a specific actor who also follows the recipient actor, + * and the server has failed to de-duplicate the recipients list. + * Such deduplication MUST be performed by comparing the `id` of the activities + * and dropping any activities already seen. + */ + + async getInbox( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < 1) return null; + const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; + if (v instanceof URL) { + const fetched = await this.#fetchInbox(v, options); + if (fetched == null) return null; + this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; } - async #inbox_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await OrderedCollection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await OrderedCollectionPage.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#OrderedCollectionPage"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getInbox}, - * but returns its `@id` URL instead of the object itself. - */ - get inboxId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < 1) return null; - const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** The inbox stream contains all activities received by the actor. The server - * SHOULD filter content according to the requester's permission. In general, - * the owner of an inbox is likely to be able to access all of their inbox - * contents. Depending on access control, some other content may be public, - * whereas other content may require authentication for non-owner users, - * if they can access the inbox at all. - * - * The server MUST perform de-duplication of activities returned by the inbox. - * Duplication can occur if an activity is addressed both to an actor's - * followers, and a specific actor who also follows the recipient actor, - * and the server has failed to de-duplicate the recipients list. - * Such deduplication MUST be performed by comparing the `id` of the activities - * and dropping any activities already seen. - * - */ + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "inbox" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "inbox" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#inbox_fromJsonLd(obj, options); + } + } - async getInbox( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < 1) return null; - const v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchInbox(v, options); - if (fetched == null) return null; - this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "inbox" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "inbox"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#inbox_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchOutbox( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + return v; + } + + async #fetchOutbox( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -19698,7 +22666,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -19708,20 +22676,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#outbox_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -19733,140 +22701,146 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #outbox_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await OrderedCollection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await OrderedCollectionPage.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError( + "Expected an object of any type of: " + + [ + "https://www.w3.org/ns/activitystreams#OrderedCollection", + "https://www.w3.org/ns/activitystreams#OrderedCollectionPage", + ].join(", "), + ); + } + + /** + * Similar to + * {@link Application.getOutbox}, + * but returns its `@id` URL instead of the object itself. + */ + get outboxId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + if (this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < 1) return null; + const v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; + if (v instanceof URL) return v; + return v.id; + } - async #outbox_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await OrderedCollection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await OrderedCollectionPage.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#OrderedCollectionPage"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getOutbox}, - * but returns its `@id` URL instead of the object itself. - */ - get outboxId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < 1) return null; - const v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** The outbox stream contains activities the user has published, - * subject to the ability of the requestor to retrieve the activity - * (that is, the contents of the outbox are filtered by the permissions of - * the person reading it). If a user submits a request without - * [Authorization](https://www.w3.org/TR/activitypub/#authorization) - * the server should respond with all of the - * [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts. - * This could potentially be all relevant objects published by the user, - * though the number of available items is left to the discretion of those - * implementing and deploying the server. - * - */ + /** The outbox stream contains activities the user has published, + * subject to the ability of the requestor to retrieve the activity + * (that is, the contents of the outbox are filtered by the permissions of + * the person reading it). If a user submits a request without + * [Authorization](https://www.w3.org/TR/activitypub/#authorization) + * the server should respond with all of the + * [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts. + * This could potentially be all relevant objects published by the user, + * though the number of available items is left to the discretion of those + * implementing and deploying the server. + */ - async getOutbox( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < 1) return null; - const v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchOutbox(v, options); - if (fetched == null) return null; - this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "outbox" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "outbox"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#outbox_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchFollowing( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + async getOutbox( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < 1) return null; + const v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; + if (v instanceof URL) { + const fetched = await this.#fetchOutbox(v, options); + if (fetched == null) return null; + this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "outbox" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "outbox" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#outbox_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchFollowing( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -19879,7 +22853,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -19889,20 +22863,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#following_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -19914,126 +22888,129 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #following_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #following_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getFollowing}, - * but returns its `@id` URL instead of the object itself. - */ - get followingId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < 1) return null; - const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** This is a list of everybody that the actor has followed, added as a - * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). - * The `following` collection MUST be either an {@link OrderedCollection} - * or a {@link Collection} and MAY be filtered on privileges of - * an authenticated user or as appropriate when no authentication is given. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getFollowing( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < 1) return null; - const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchFollowing(v, options); - if (fetched == null) return null; - this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "following" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "following"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#following_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchFollowers( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Application.getFollowing}, + * but returns its `@id` URL instead of the object itself. + */ + get followingId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < 1) return null; + const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** This is a list of everybody that the actor has followed, added as a + * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). + * The `following` collection MUST be either an {@link OrderedCollection} + * or a {@link Collection} and MAY be filtered on privileges of + * an authenticated user or as appropriate when no authentication is given. + */ + + async getFollowing( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < 1) return null; + const v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; + if (v instanceof URL) { + const fetched = await this.#fetchFollowing(v, options); + if (fetched == null) return null; + this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "following" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "following" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#following_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchFollowers( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -20046,7 +23023,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -20056,20 +23033,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#followers_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -20081,129 +23058,132 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #followers_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #followers_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getFollowers}, - * but returns its `@id` URL instead of the object itself. - */ - get followersId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < 1) return null; - const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** This is a list of everyone who has sent a {@link Follow} activity - * for the actor, added as a - * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). - * This is where one would find a list of all the actors that are following - * the actor. The `followers` collection MUST be either - * an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on - * privileges of an authenticated user or as appropriate when no authentication - * is given. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getFollowers( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < 1) return null; - const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchFollowers(v, options); - if (fetched == null) return null; - this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "followers" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "followers"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#followers_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchLiked( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Application.getFollowers}, + * but returns its `@id` URL instead of the object itself. + */ + get followersId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < 1) return null; + const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** This is a list of everyone who has sent a {@link Follow} activity + * for the actor, added as a + * [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox). + * This is where one would find a list of all the actors that are following + * the actor. The `followers` collection MUST be either + * an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on + * privileges of an authenticated user or as appropriate when no authentication + * is given. + */ + + async getFollowers( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < 1) return null; + const v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; + if (v instanceof URL) { + const fetched = await this.#fetchFollowers(v, options); + if (fetched == null) return null; + this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "followers" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "followers" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#followers_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchLiked( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -20216,7 +23196,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -20226,20 +23206,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#liked_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -20251,127 +23231,130 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #liked_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #liked_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getLiked}, - * but returns its `@id` URL instead of the object itself. - */ - get likedId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < 1) return null; - const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** This is a list of every object from all of the actor's {@link Like} - * activities, added as a - * [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox). - * The `liked` collection MUST be either an {@link OrderedCollection} or - * a {@link Collection} and MAY be filtered on privileges of an authenticated - * user or as appropriate when no authentication is given. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getLiked( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < 1) return null; - const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchLiked(v, options); - if (fetched == null) return null; - this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "liked" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "liked"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#liked_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchFeatured( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Application.getLiked}, + * but returns its `@id` URL instead of the object itself. + */ + get likedId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < 1) return null; + const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** This is a list of every object from all of the actor's {@link Like} + * activities, added as a + * [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox). + * The `liked` collection MUST be either an {@link OrderedCollection} or + * a {@link Collection} and MAY be filtered on privileges of an authenticated + * user or as appropriate when no authentication is given. + */ + + async getLiked( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < 1) return null; + const v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; + if (v instanceof URL) { + const fetched = await this.#fetchLiked(v, options); + if (fetched == null) return null; + this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "liked" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "liked" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#liked_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchFeatured( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -20384,7 +23367,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -20394,20 +23377,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#featured_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -20419,125 +23402,128 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #featured_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #featured_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getFeatured}, - * but returns its `@id` URL instead of the object itself. - */ - get featuredId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < 1) return null; - const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** What is known in Mastodon as "pinned statuses", or statuses that are always - * featured at the top of people's profiles, is implemented using an extra - * property `featured` on the actor object that points to a {@link Collection} - * of objects. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getFeatured( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < 1) return null; - const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchFeatured(v, options); - if (fetched == null) return null; - this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "featured" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "featured"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#featured_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchFeaturedTags( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Application.getFeatured}, + * but returns its `@id` URL instead of the object itself. + */ + get featuredId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < 1) return null; + const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** What is known in Mastodon as "pinned statuses", or statuses that are always + * featured at the top of people's profiles, is implemented using an extra + * property `featured` on the actor object that points to a {@link Collection} + * of objects. + */ + + async getFeatured( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < 1) return null; + const v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; + if (v instanceof URL) { + const fetched = await this.#fetchFeatured(v, options); + if (fetched == null) return null; + this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "featured" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "featured" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#featured_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchFeaturedTags( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -20550,7 +23536,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -20560,20 +23546,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#featuredTags_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -20585,125 +23571,132 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #featuredTags_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #featuredTags_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getFeaturedTags}, - * but returns its `@id` URL instead of the object itself. - */ - get featuredTagsId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < 1) return null; - const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** What is known in Mastodon as "featured hashtags", hashtags that are featured - * at people's profiles, is implemented using an extra property `featuredTags` - * on the actor object that points to a {@link Collection} of {@link Hashtag} - * objects specifically. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } - async getFeaturedTags( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < 1) return null; - const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchFeaturedTags(v, options); - if (fetched == null) return null; - this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "featuredTags" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "featuredTags"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#featuredTags_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchStream( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + /** + * Similar to + * {@link Application.getFeaturedTags}, + * but returns its `@id` URL instead of the object itself. + */ + get featuredTagsId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < 1) { + return null; + } + const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** What is known in Mastodon as "featured hashtags", hashtags that are featured + * at people's profiles, is implemented using an extra property `featuredTags` + * on the actor object that points to a {@link Collection} of {@link Hashtag} + * objects specifically. + */ + + async getFeaturedTags( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < 1) { + return null; + } + const v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; + if (v instanceof URL) { + const fetched = await this.#fetchFeaturedTags(v, options); + if (fetched == null) return null; + this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "featuredTags" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "featuredTags" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#featuredTags_fromJsonLd(obj, options); + } + } + + return v; + } + + async #fetchStream( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -20716,7 +23709,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -20726,20 +23719,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#stream_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -20751,201 +23744,203 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #stream_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Collection.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/activitystreams#Collection"].join(", "), + ); + } + + /** + * Similar to + * {@link Application.getStreams}, + * but returns their `@id`s instead of the objects themselves. + */ + get streamIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** A list of supplementary Collections which may be of interest. + */ + + async *getStreams( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchStream( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "streams" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "streams" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#stream_fromJsonLd(obj, options); + continue; + } + } + + yield v; + } + } + + /** A JSON object which maps additional (typically server/domain-wide) endpoints + * which may be useful either for this actor or someone referencing this actor. + * This mapping may be nested inside the actor document as the value or may be + * a link to a JSON-LD document with these properties. + */ + get endpoints(): Endpoints | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < 1) return null; + return this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[0]; + } + + /** Allows users to opt-in or opt-out of discoverability features like + * the profile directory. This flag may also be used as an indicator of + * the user's preferences toward being included in external discovery services, + * such as search engines or other indexing tools. + */ + get discoverable(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < 1) return null; + return this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable[0]; + } + + /** Reports whether a user was locally suspended, for better handling of + * these accounts. + */ + get suspended(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < 1) return null; + return this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended[0]; + } + + /** Whether the actor is in-memorial state. + */ + get memorial(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); } + if (this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < 1) return null; + return this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial[0]; + } - async #stream_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Collection.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/activitystreams#Collection"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getStreams}, - * but returns their `@id`s instead of the objects themselves. - */ - get streamIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** A list of supplementary Collections which may be of interest. - * - */ + /** Whether the actor allows to be indexed. + */ + get indexable(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < 1) return null; + return this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable[0]; + } - async* getStreams( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchStream( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "streams" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "streams"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#stream_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } - } - -/** A JSON object which maps additional (typically server/domain-wide) endpoints - * which may be useful either for this actor or someone referencing this actor. - * This mapping may be nested inside the actor document as the value or may be - * a link to a JSON-LD document with these properties. - * - */ - get endpoints(): (Endpoints | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < 1) return null; - return this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[0]; - } - -/** Allows users to opt-in or opt-out of discoverability features like - * the profile directory. This flag may also be used as an indicator of - * the user's preferences toward being included in external discovery services, - * such as search engines or other indexing tools. - * - */ - get discoverable(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < 1) return null; - return this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable[0]; - } - -/** Reports whether a user was locally suspended, for better handling of - * these accounts. - * - */ - get suspended(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < 1) return null; - return this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended[0]; - } - -/** Whether the actor is in-memorial state. - */ - get memorial(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < 1) return null; - return this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial[0]; - } - -/** Whether the actor allows to be indexed. - */ - get indexable(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < 1) return null; - return this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable[0]; - } - - async #fetchSuccessor( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + async #fetchSuccessor( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -20958,7 +23953,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -20968,20 +23963,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#successor_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -20993,157 +23988,167 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #successor_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #successor_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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 Application.getSuccessor}, - * but returns its `@id` URL instead of the object itself. - */ - get successorId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < 1) return null; - const v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; - if (v instanceof URL) return v; - return v.id; + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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 Application.getSuccessor}, + * but returns its `@id` URL instead of the object itself. + */ + get successorId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < 1) return null; + const v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details. + */ + + async getSuccessor( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < 1) return null; + const v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; + if (v instanceof URL) { + const fetched = await this.#fetchSuccessor(v, options); + if (fetched == null) return null; + this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "movedTo" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "movedTo" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#successor_fromJsonLd(obj, options); } - -/** Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details. - */ + } - async getSuccessor( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < 1) return null; - const v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchSuccessor(v, options); - if (fetched == null) return null; - this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "movedTo" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "movedTo"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#successor_fromJsonLd(obj, options); - } - } - - return v; - } - - async #fetchAlias( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + return v; + } + + async #fetchAlias( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -21156,7 +24161,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -21166,20 +24171,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#alias_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -21191,232 +24196,242 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #alias_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await Application.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #alias_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await Application.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Group.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Organization.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Person.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - try { - return await Service.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } 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 Application.getAlias}, - * but returns its `@id` URL instead of the object itself. - */ - get aliasId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < 1) return null; - const v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** The `aliases` (`alsoKnownAs`) property is used to specify alternative names - * or aliases for an entity. It can be used to provide additional identifiers - * or labels for an entity, which can be useful in scenarios where an entity - * may have multiple names or aliases. - * - */ + try { + return await Group.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - async getAlias( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < 1) return null; - const v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchAlias(v, options); - if (fetched == null) return null; - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "alsoKnownAs" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "alsoKnownAs"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#alias_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Application.getAliases}, - * but returns their `@id`s instead of the objects themselves. - */ - get aliasIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); - } - -/** The `aliases` (`alsoKnownAs`) property is used to specify alternative names - * or aliases for an entity. It can be used to provide additional identifiers - * or labels for an entity, which can be useful in scenarios where an entity - * may have multiple names or aliases. - * - */ + try { + return await Organization.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } - async* getAliases( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchAlias( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "alsoKnownAs" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "alsoKnownAs"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#alias_fromJsonLd(obj, options); - continue; - } - } - - yield v; + try { + return await Person.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; + } + + try { + return await Service.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } 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 Application.getAlias}, + * but returns its `@id` URL instead of the object itself. + */ + get aliasId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < 1) return null; + const v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** The `aliases` (`alsoKnownAs`) property is used to specify alternative names + * or aliases for an entity. It can be used to provide additional identifiers + * or labels for an entity, which can be useful in scenarios where an entity + * may have multiple names or aliases. + */ + + async getAlias( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < 1) return null; + const v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; + if (v instanceof URL) { + const fetched = await this.#fetchAlias(v, options); + if (fetched == null) return null; + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "alsoKnownAs" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "alsoKnownAs" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#alias_fromJsonLd(obj, options); + } + } + + return v; + } + + /** + * Similar to + * {@link Application.getAliases}, + * but returns their `@id`s instead of the objects themselves. + */ + get aliasIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** The `aliases` (`alsoKnownAs`) property is used to specify alternative names + * or aliases for an entity. It can be used to provide additional identifiers + * or labels for an entity, which can be useful in scenarios where an entity + * may have multiple names or aliases. + */ + + async *getAliases( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchAlias( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "alsoKnownAs" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "alsoKnownAs" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#alias_fromJsonLd(obj, options); + continue; } } - - async #fetchService( - url: URL, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): 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/fedify", - "1.8.0", - ); - return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => { + + yield v; + } + } + + async #fetchService( + url: URL, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): 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/fedify", + "1.8.0", + ); + return await tracer.startActiveSpan( + "activitypub.lookup_object", + async (span) => { let fetchResult: RemoteDocument; try { fetchResult = await documentLoader(url.href); @@ -21429,7 +24444,7 @@ get preferredUsernames(): ((string | LanguageString))[] { if (options.suppressError) { getLogger(["fedify", "vocab"]).error( "Failed to fetch {url}: {error}", - { error, url: url.href } + { error, url: url.href }, ); return null; } @@ -21439,20 +24454,20 @@ get preferredUsernames(): ((string | LanguageString))[] { try { const obj = await this.#service_fromJsonLd( document, - { documentLoader, contextLoader, tracerProvider } + { documentLoader, contextLoader, tracerProvider }, ); 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 + 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 } + { error: e, url: url.href }, ); return null; } @@ -21464,207 +24479,209 @@ get preferredUsernames(): ((string | LanguageString))[] { } finally { span.end(); } - }); + }, + ); + } + + async #service_fromJsonLd( + jsonLd: unknown, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; + }, + ): Promise { + const documentLoader = options.documentLoader ?? this._documentLoader ?? + getDocumentLoader(); + const contextLoader = options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(); + const tracerProvider = options.tracerProvider ?? + this._tracerProvider ?? trace.getTracerProvider(); + + try { + return await DidService.fromJsonLd( + jsonLd, + { documentLoader, contextLoader, tracerProvider }, + ); + } catch (e) { + if (!(e instanceof TypeError)) throw e; } - async #service_fromJsonLd( - jsonLd: unknown, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, - } - ): Promise { - const documentLoader = - options.documentLoader ?? this._documentLoader ?? getDocumentLoader(); - const contextLoader = - options.contextLoader ?? this._contextLoader ?? getDocumentLoader(); - const tracerProvider = options.tracerProvider ?? - this._tracerProvider ?? trace.getTracerProvider(); - - try { - return await DidService.fromJsonLd( - jsonLd, - { documentLoader, contextLoader, tracerProvider }, - ); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - } - - throw new TypeError("Expected an object of any type of: " + - ["https://www.w3.org/ns/did#Service"].join(", ")); - } - - - /** - * Similar to - * {@link Application.getService}, - * but returns its `@id` URL instead of the object itself. - */ - get serviceId(): URL | null { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < 1) return null; - const v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; - if (v instanceof URL) return v; - return v.id; - } - -/** Means of communicating or interacting with the DID subject or associated - * entities via one or more service endpoints. Examples include discovery - * services, agent services, social networking services, file storage services, - * and verifiable credential repository services. - * - */ + throw new TypeError( + "Expected an object of any type of: " + + ["https://www.w3.org/ns/did#Service"].join(", "), + ); + } - async getService( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): Promise { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < 1) return null; - const v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; - if (v instanceof URL) { - const fetched = - await this.#fetchService(v, options); - if (fetched == null) return null; - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0] = fetched; - this._cachedJsonLd = undefined; - return fetched; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "service" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "service"]; - const obj = Array.isArray(prop) ? prop[0] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - return await this.#service_fromJsonLd(obj, options); - } - } - - return v; - } - - /** - * Similar to - * {@link Application.getServices}, - * but returns their `@id`s instead of the objects themselves. - */ - get serviceIds(): URL[] { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - return this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.map((v) => - v instanceof URL ? v : v.id! - ).filter(id => id !== null); + /** + * Similar to + * {@link Application.getService}, + * but returns its `@id` URL instead of the object itself. + */ + get serviceId(): URL | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < 1) return null; + const v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; + if (v instanceof URL) return v; + return v.id; + } + + /** Means of communicating or interacting with the DID subject or associated + * entities via one or more service endpoints. Examples include discovery + * services, agent services, social networking services, file storage services, + * and verifiable credential repository services. + */ + + async getService( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): Promise { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < 1) return null; + const v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; + if (v instanceof URL) { + const fetched = await this.#fetchService(v, options); + if (fetched == null) return null; + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0] = fetched; + this._cachedJsonLd = undefined; + return fetched; + } + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "service" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "service" + ]; + const obj = Array.isArray(prop) ? prop[0] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + return await this.#service_fromJsonLd(obj, options); } - -/** Means of communicating or interacting with the DID subject or associated - * entities via one or more service endpoints. Examples include discovery - * services, agent services, social networking services, file storage services, - * and verifiable credential repository services. - * - */ + } - async* getServices( - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - suppressError?: boolean, - tracerProvider?: TracerProvider, - } = {} - ): AsyncIterable { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - const vs = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; - for (let i = 0; i < vs.length; i++) { - const v = vs[i]; - if (v instanceof URL) { - const fetched = - await this.#fetchService( - v, options); - if (fetched == null) continue; - vs[i] = fetched; - this._cachedJsonLd = undefined; - yield fetched; - continue; - } - - if ( - this._cachedJsonLd != null && - typeof this._cachedJsonLd === "object" && - "@context" in this._cachedJsonLd && - "service" in this._cachedJsonLd - ) { - const prop = this._cachedJsonLd[ - "service"]; - const obj = Array.isArray(prop) ? prop[i] : prop; - if (obj != null && typeof obj === "object" && "@context" in obj) { - yield await this.#service_fromJsonLd(obj, options); - continue; - } - } - - yield v; - } + return v; + } + + /** + * Similar to + * {@link Application.getServices}, + * but returns their `@id`s instead of the objects themselves. + */ + get serviceIds(): URL[] { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + return this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.map((v) => + v instanceof URL ? v : v.id! + ).filter((id) => id !== null); + } + + /** Means of communicating or interacting with the DID subject or associated + * entities via one or more service endpoints. Examples include discovery + * services, agent services, social networking services, file storage services, + * and verifiable credential repository services. + */ + + async *getServices( + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + suppressError?: boolean; + tracerProvider?: TracerProvider; + } = {}, + ): AsyncIterable { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + const vs = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + for (let i = 0; i < vs.length; i++) { + const v = vs[i]; + if (v instanceof URL) { + const fetched = await this.#fetchService( + v, + options, + ); + if (fetched == null) continue; + vs[i] = fetched; + this._cachedJsonLd = undefined; + yield fetched; + continue; } - -/** This value is used for `Actor` type objects to show message on followed. - * - */ - get followedMessage(): (string | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < 1) return null; - return this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage[0]; - } - -/** Used on actors to indicate that they in some way identify as a cat, - * expressed as a boolean value. If this property is set to `true`, - * displaying the actor or their notes will have some special effects - * attached in some clients. - * - */ - get cat(): (boolean | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); + + if ( + this._cachedJsonLd != null && + typeof this._cachedJsonLd === "object" && + "@context" in this._cachedJsonLd && + "service" in this._cachedJsonLd + ) { + const prop = this._cachedJsonLd[ + "service" + ]; + const obj = Array.isArray(prop) ? prop[i] : prop; + if (obj != null && typeof obj === "object" && "@context" in obj) { + yield await this.#service_fromJsonLd(obj, options); + continue; } - if (this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < 1) return null; - return this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat[0]; } - + + yield v; + } + } + + /** This value is used for `Actor` type objects to show message on followed. + */ + get followedMessage(): string | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if ( + this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < 1 + ) return null; + return this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage[0]; + } + + /** Used on actors to indicate that they in some way identify as a cat, + * expressed as a boolean value. If this property is set to `true`, + * displaying the actor or their notes will have some special effects + * attached in some clients. + */ + get cat(): boolean | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < 1) return null; + return this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat[0]; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -21676,9 +24693,12 @@ get preferredUsernames(): ((string | LanguageString))[] { * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -21686,485 +24706,431 @@ get preferredUsernames(): ((string | LanguageString))[] { 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'." + "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.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { - const item = ( - typeof v === "string" ? v : { - "@value": v.toString(), - "@language": v.language.compact(), - } - ); + const item = typeof v === "string" ? v : { + "@value": v.toString(), + "@language": v.language.compact(), + }; compactItems.push(item); } if (compactItems.length > 0) { - - result["preferredUsername"] - = compactItems.length > 1 + result["preferredUsername"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["publicKey"] - = compactItems.length > 1 + result["publicKey"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["assertionMethod"] - = compactItems.length > 1 + result["assertionMethod"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; - for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { - const item = ( - v - ); + for ( + const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers + ) { + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["manuallyApprovesFollowers"] - = compactItems.length > 1 + result["manuallyApprovesFollowers"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { - const item = ( - v instanceof URL ? v.href : v instanceof OrderedCollection ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL + ? v.href + : v instanceof OrderedCollection + ? await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) + : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["inbox"] - = compactItems.length > 1 + result["inbox"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { - const item = ( - v instanceof URL ? v.href : v instanceof OrderedCollection ? await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL + ? v.href + : v instanceof OrderedCollection + ? await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }) + : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["outbox"] - = compactItems.length > 1 + result["outbox"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["following"] - = compactItems.length > 1 + result["following"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["followers"] - = compactItems.length > 1 + result["followers"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["liked"] - = compactItems.length > 1 + result["liked"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["featured"] - = compactItems.length > 1 + result["featured"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["featuredTags"] - = compactItems.length > 1 + result["featuredTags"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["streams"] - = compactItems.length > 1 + result["streams"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { - const item = ( - await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["endpoints"] - = compactItems.length > 1 + result["endpoints"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["discoverable"] - = compactItems.length > 1 + result["discoverable"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["suspended"] - = compactItems.length > 1 + result["suspended"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["memorial"] - = compactItems.length > 1 + result["memorial"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["indexable"] - = compactItems.length > 1 + result["indexable"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { - 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, - }) - ); + 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["movedTo"] - = compactItems.length > 1 + result["movedTo"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { - 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, - }) - ); + 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["alsoKnownAs"] - = compactItems.length > 1 + result["alsoKnownAs"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { - const item = ( - v instanceof URL ? v.href : await v.toJsonLd({ - ...(options), - format: undefined, - context: undefined, - }) - ); + const item = v instanceof URL ? v.href : await v.toJsonLd({ + ...options, + format: undefined, + context: undefined, + }); compactItems.push(item); } if (compactItems.length > 0) { - - result["service"] - = compactItems.length > 1 + result["service"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; - for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { - const item = ( - v - ); + for ( + const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage + ) { + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["_misskey_followedMessage"] - = compactItems.length > 1 + result["_misskey_followedMessage"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["isCat"] - = compactItems.length > 1 + result["isCat"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + 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", + { + "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; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - + const baseValues = await super.toJsonLd({ ...options, format: "expand", @@ -22174,340 +25140,283 @@ get preferredUsernames(): ((string | LanguageString))[] { string, unknown[] | { "@list": unknown[] } | string >; - + array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { - const element = ( - typeof v === "string" ? { "@value": v } : { + const element = typeof v === "string" ? { "@value": v } : { "@value": v.toString(), "@language": v.language.compact(), - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#preferredUsername"] = propValue; - + const propValue = array; + values["https://www.w3.org/ns/activitystreams#preferredUsername"] = + propValue; } - + array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#publicKey"] = propValue; - } - + array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://w3id.org/security#assertionMethod"] = propValue; - } - + array = []; - for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { - const element = ( - { "@value": v } - ); - array.push(element);; + for ( + const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers + ) { + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); - values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"] = propValue; - + const propValue = array; + values[ + "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers" + ] = propValue; } - + array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof OrderedCollection + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://www.w3.org/ns/ldp#inbox"] = propValue; - } - + array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { - const element = ( - v instanceof URL ? { "@id": v.href } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : v instanceof OrderedCollection + ? await v.toJsonLd(options) + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#outbox"] = propValue; - } - + array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#following"] = propValue; - } - + array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#followers"] = propValue; - } - + array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#liked"] = propValue; - } - + array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://joinmastodon.org/ns#featured"] = propValue; - } - + array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://joinmastodon.org/ns#featuredTags"] = propValue; - } - + array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#streams"] = propValue; - } - + array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { - const element = ( - await v.toJsonLd(options) - ); - array.push(element);; + const element = await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#endpoints"] = propValue; - } - + array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://joinmastodon.org/ns#discoverable"] = propValue; - } - + array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://joinmastodon.org/ns#suspended"] = propValue; - } - + array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://joinmastodon.org/ns#memorial"] = propValue; - } - + array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["http://joinmastodon.org/ns#indexable"] = propValue; - } - + array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { - 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);; + 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 - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#movedTo"] = propValue; - } - + array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { - 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);; + 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 - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#alsoKnownAs"] = propValue; - } - + array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { - const element = ( - v instanceof URL ? { "@id": v.href } : await v.toJsonLd(options) - ); - array.push(element);; + const element = v instanceof URL + ? { "@id": v.href } + : await v.toJsonLd(options); + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/did#service"] = propValue; - } - + array = []; - for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { - const element = ( - { "@value": v } - ); - array.push(element);; + for ( + const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage + ) { + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://misskey-hub.net/ns#_misskey_followedMessage"] = propValue; - } - + array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { - const element = ( - { "@value": v } - ); - array.push(element);; + const element = { "@value": v }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://misskey-hub.net/ns#isCat"] = propValue; - } - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Application"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -22517,7 +25426,32 @@ 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", + { + "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, @@ -22525,37 +25459,37 @@ get preferredUsernames(): ((string | LanguageString))[] { ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + compacted.proof["@context"] = docContext; } } - } return compacted; } protected override isCompactable(): boolean { + if ( + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null && + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0 + ) return false; + + if ( + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service != null && + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length > 0 + ) return false; - if ( - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername != null && - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0 - ) return false; - - if ( - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service != null && - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length > 0 - ) return false; - return super.isCompactable(); } - + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -22570,9 +25504,9 @@ get preferredUsernames(): ((string | LanguageString))[] { static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -22585,7 +25519,10 @@ get preferredUsernames(): ((string | LanguageString))[] { async (span) => { try { const object = await this.__fromJsonLd__Application__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -22607,15 +25544,14 @@ get preferredUsernames(): ((string | LanguageString))[] { json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -22635,18 +25571,23 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://www.w3.org/ns/activitystreams#Application")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://www.w3.org/ns/activitystreams#Application", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -22656,538 +25597,764 @@ get preferredUsernames(): ((string | LanguageString))[] { if (!(instance instanceof Application)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - const _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; + const _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: + ((string | LanguageString))[] = []; + + let _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array = + values["https://www.w3.org/ns/activitystreams#preferredUsername"]; - let _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array = values["https://www.w3.org/ns/activitystreams#preferredUsername"]; - for ( const v of _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array == null ? [] - : _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array.length === 1 && "@list" in _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array[0] + : _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array.length === 1 && + "@list" in _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array[0] ? _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__array[0]["@list"] : _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername__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 - ; + + 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; _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.push(decoded); - } - instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; - const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; + instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = + _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; + const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = + []; + + let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = + values["https://w3id.org/security#publicKey"]; - let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values["https://w3id.org/security#publicKey"]; - for ( const v of _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array == null ? [] - : _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array.length === 1 && "@list" in _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array[0] + : _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array.length === 1 && + "@list" in _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array[0] ? _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array[0]["@list"] : _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(await CryptographicKey.fromJsonLd( - v, options)) + _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push( + await CryptographicKey.fromJsonLd( + v, + options, + ), + ); } - instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; - const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; + instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = + _axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = + []; + + let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = + values["https://w3id.org/security#assertionMethod"]; - let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values["https://w3id.org/security#assertionMethod"]; - for ( const v of _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array == null ? [] - : _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array.length === 1 && "@list" in _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array[0] + : _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array.length === 1 && + "@list" in _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array[0] ? _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array[0]["@list"] : _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(await Multikey.fromJsonLd( - v, options)) + _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push( + await Multikey.fromJsonLd( + v, + options, + ), + ); } - instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; - const _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; + instance.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = + _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = + []; + + let _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array = + values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"]; - let _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array = values["https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers"]; - for ( - const v of _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array == null - ? [] - : _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array.length === 1 && "@list" in _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array[0] - ? _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array[0]["@list"] - : _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array + const v + of _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array == null + ? [] + : _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array + .length === 1 && + "@list" in + _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array[0] + ? _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array[0][ + "@list" + ] + : _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers__array ) { if (v == null) continue; - _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.push(v["@value"]) + _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.push(v["@value"]); } - instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; - const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; + instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = + _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; + const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: + (OrderedCollection | OrderedCollectionPage | URL)[] = []; + + let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = + values["http://www.w3.org/ns/ldp#inbox"]; - let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values["http://www.w3.org/ns/ldp#inbox"]; - for ( const v of _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array == null ? [] - : _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array.length === 1 && "@list" in _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array[0] + : _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array.length === 1 && + "@list" in _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array[0] ? _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array[0]["@list"] : _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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#OrderedCollection") ? await OrderedCollection.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollectionPage") ? await OrderedCollectionPage.fromJsonLd( - v, options) : undefined - ; + + const decoded = typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + v["@type"].includes( + "https://www.w3.org/ns/activitystreams#OrderedCollection", + ) + ? await OrderedCollection.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + v["@type"].includes( + "https://www.w3.org/ns/activitystreams#OrderedCollectionPage", + ) + ? await OrderedCollectionPage.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.push(decoded); - } - instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; - const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; + instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = + _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const _41QwhqJouoLg3h8dRPKat21brynC_outbox: + (OrderedCollection | OrderedCollectionPage | URL)[] = []; + + let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = + values["https://www.w3.org/ns/activitystreams#outbox"]; - let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values["https://www.w3.org/ns/activitystreams#outbox"]; - for ( const v of _41QwhqJouoLg3h8dRPKat21brynC_outbox__array == null ? [] - : _41QwhqJouoLg3h8dRPKat21brynC_outbox__array.length === 1 && "@list" in _41QwhqJouoLg3h8dRPKat21brynC_outbox__array[0] + : _41QwhqJouoLg3h8dRPKat21brynC_outbox__array.length === 1 && + "@list" in _41QwhqJouoLg3h8dRPKat21brynC_outbox__array[0] ? _41QwhqJouoLg3h8dRPKat21brynC_outbox__array[0]["@list"] : _41QwhqJouoLg3h8dRPKat21brynC_outbox__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _41QwhqJouoLg3h8dRPKat21brynC_outbox.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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#OrderedCollection") ? await OrderedCollection.fromJsonLd( - v, options) : typeof v === "object" && "@type" in v - && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#OrderedCollectionPage") ? await OrderedCollectionPage.fromJsonLd( - v, options) : undefined - ; + + const decoded = typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + v["@type"].includes( + "https://www.w3.org/ns/activitystreams#OrderedCollection", + ) + ? await OrderedCollection.fromJsonLd( + v, + options, + ) + : typeof v === "object" && "@type" in v && + Array.isArray(v["@type"]) && + v["@type"].includes( + "https://www.w3.org/ns/activitystreams#OrderedCollectionPage", + ) + ? await OrderedCollectionPage.fromJsonLd( + v, + options, + ) + : undefined; if (typeof decoded === "undefined") continue; _41QwhqJouoLg3h8dRPKat21brynC_outbox.push(decoded); - } - instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; + instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = + _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values["https://www.w3.org/ns/activitystreams#following"]; - + let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = + values["https://www.w3.org/ns/activitystreams#following"]; + for ( const v of _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array == null ? [] - : _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array.length === 1 && "@list" in _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array[0] + : _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array.length === 1 && + "@list" in _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array[0] ? _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array[0]["@list"] : _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(await Collection.fromJsonLd( - v, options)) + _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = + _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values["https://www.w3.org/ns/activitystreams#followers"]; - + let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = + values["https://www.w3.org/ns/activitystreams#followers"]; + for ( const v of _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array == null ? [] - : _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array.length === 1 && "@list" in _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array[0] + : _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array.length === 1 && + "@list" in _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array[0] ? _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array[0]["@list"] : _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(await Collection.fromJsonLd( - v, options)) + _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = + _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values["https://www.w3.org/ns/activitystreams#liked"]; - + let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = + values["https://www.w3.org/ns/activitystreams#liked"]; + for ( const v of _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array == null ? [] - : _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array.length === 1 && "@list" in _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array[0] + : _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array.length === 1 && + "@list" in _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array[0] ? _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array[0]["@list"] : _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(await Collection.fromJsonLd( - v, options)) + _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = + _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values["http://joinmastodon.org/ns#featured"]; - + let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = + values["http://joinmastodon.org/ns#featured"]; + for ( const v of _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array == null ? [] - : _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array.length === 1 && "@list" in _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array[0] + : _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array.length === 1 && + "@list" in _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array[0] ? _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array[0]["@list"] : _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(await Collection.fromJsonLd( - v, options)) + _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; + instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = + _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values["http://joinmastodon.org/ns#featuredTags"]; - + let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = + values["http://joinmastodon.org/ns#featuredTags"]; + for ( const v of _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array == null ? [] - : _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array.length === 1 && "@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array[0] + : _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array.length === 1 && + "@list" in _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array[0] ? _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array[0]["@list"] : _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(await Collection.fromJsonLd( - v, options)) + _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = + _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values["https://www.w3.org/ns/activitystreams#streams"]; - + let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = + values["https://www.w3.org/ns/activitystreams#streams"]; + for ( const v of _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array == null ? [] - : _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array.length === 1 && "@list" in _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array[0] + : _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array.length === 1 && + "@list" in _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array[0] ? _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array[0]["@list"] : _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(await Collection.fromJsonLd( - v, options)) + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push( + await Collection.fromJsonLd( + v, + options, + ), + ); } - instance.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + instance.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; - let _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array = values["https://www.w3.org/ns/activitystreams#endpoints"]; - + let _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array = + values["https://www.w3.org/ns/activitystreams#endpoints"]; + for ( const v of _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array == null ? [] - : _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array.length === 1 && "@list" in _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array[0] + : _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array.length === 1 && + "@list" in _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array[0] ? _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array[0]["@list"] : _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints__array ) { if (v == null) continue; - _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(await Endpoints.fromJsonLd( - v, options)) + _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push( + await Endpoints.fromJsonLd( + v, + options, + ), + ); } - instance.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + instance.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = + _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; const _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; - let _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array = values["http://joinmastodon.org/ns#discoverable"]; - + let _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array = + values["http://joinmastodon.org/ns#discoverable"]; + for ( const v of _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array == null ? [] - : _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array.length === 1 && "@list" in _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array[0] + : _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array.length === 1 && + "@list" in _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array[0] ? _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array[0]["@list"] : _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable__array ) { if (v == null) continue; - _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.push(v["@value"]) + _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.push(v["@value"]); } - instance.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; + instance.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = + _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; const _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; - let _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array = values["http://joinmastodon.org/ns#suspended"]; - + let _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array = + values["http://joinmastodon.org/ns#suspended"]; + for ( const v of _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array == null ? [] - : _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array.length === 1 && "@list" in _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array[0] + : _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array.length === 1 && + "@list" in _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array[0] ? _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array[0]["@list"] : _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended__array ) { if (v == null) continue; - _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.push(v["@value"]) + _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.push(v["@value"]); } - instance.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended; + instance.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = + _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended; const _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial: (boolean)[] = []; - let _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array = values["http://joinmastodon.org/ns#memorial"]; - + let _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array = + values["http://joinmastodon.org/ns#memorial"]; + for ( const v of _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array == null ? [] - : _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array.length === 1 && "@list" in _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array[0] + : _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array.length === 1 && + "@list" in _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array[0] ? _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array[0]["@list"] : _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial__array ) { if (v == null) continue; - _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.push(v["@value"]) + _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.push(v["@value"]); } - instance.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial; + instance.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = + _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial; const _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; - let _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array = values["http://joinmastodon.org/ns#indexable"]; - + let _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array = + values["http://joinmastodon.org/ns#indexable"]; + for ( const v of _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array == null ? [] - : _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array.length === 1 && "@list" in _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array[0] + : _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array.length === 1 && + "@list" in _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array[0] ? _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array[0]["@list"] : _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable__array ) { if (v == null) continue; - _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.push(v["@value"]) + _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.push(v["@value"]); } - instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; - const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; + instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = + _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; + const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: + (Application | Group | Organization | Person | Service | URL)[] = []; + + let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = + values["https://www.w3.org/ns/activitystreams#movedTo"]; - let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values["https://www.w3.org/ns/activitystreams#movedTo"]; - for ( const v of _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array == null ? [] - : _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array.length === 1 && "@list" in _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array[0] + : _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array.length === 1 && + "@list" in _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array[0] ? _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array[0]["@list"] : _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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) : 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) : 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) : 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) : 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) : undefined - ; + + 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : undefined; if (typeof decoded === "undefined") continue; _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.push(decoded); - } - instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; - const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; + instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = + _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: + (Application | Group | Organization | Person | Service | URL)[] = []; + + let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = + values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; - let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; - for ( const v of _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array == null ? [] - : _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array.length === 1 && "@list" in _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array[0] + : _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array.length === 1 && + "@list" in _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array[0] ? _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array[0]["@list"] : _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : 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) : 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) : 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) : 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) : 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) : undefined - ; + + 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : 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, + ) + : undefined; if (typeof decoded === "undefined") continue; _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.push(decoded); - } - instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = + _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values["https://www.w3.org/ns/did#service"]; - + let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = + values["https://www.w3.org/ns/did#service"]; + for ( const v of _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array == null ? [] - : _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array.length === 1 && "@list" in _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array[0] + : _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array.length === 1 && + "@list" in _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array[0] ? _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array[0]["@list"] : _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array ) { if (v == null) continue; - - if (typeof v === "object" && "@id" in v && !("@type" in v) - && globalThis.Object.keys(v).length === 1) { + + if ( + typeof v === "object" && "@id" in v && !("@type" in v) && + globalThis.Object.keys(v).length === 1 + ) { _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push( !URL.canParse(v["@id"]) && v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].substring(5))) - : new URL(v["@id"]) + : new URL(v["@id"]), ); continue; } - _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(await DidService.fromJsonLd( - v, options)) + _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push( + await DidService.fromJsonLd( + v, + options, + ), + ); } - instance.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; - const _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; + instance.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = + _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = + []; + + let _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array = + values["https://misskey-hub.net/ns#_misskey_followedMessage"]; - let _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array = values["https://misskey-hub.net/ns#_misskey_followedMessage"]; - for ( - const v of _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array == null - ? [] - : _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array.length === 1 && "@list" in _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array[0] - ? _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array[0]["@list"] - : _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array + const v + of _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array == null + ? [] + : _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array + .length === 1 && + "@list" in + _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array[0] + ? _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array[0][ + "@list" + ] + : _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage__array ) { if (v == null) continue; - _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.push(v["@value"]) + _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.push(v["@value"]); } - instance.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage; + instance.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = + _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage; const _2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; - let _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array = values["https://misskey-hub.net/ns#isCat"]; - + let _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array = + values["https://misskey-hub.net/ns#isCat"]; + for ( const v of _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array == null ? [] - : _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array.length === 1 && "@list" in _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array[0] + : _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array.length === 1 && + "@list" in _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array[0] ? _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array[0]["@list"] : _2xEU4QtkC53RAun67T81Egqt9vmL_isCat__array ) { if (v == null) continue; - _2xEU4QtkC53RAun67T81Egqt9vmL_isCat.push(v["@value"]) + _2xEU4QtkC53RAun67T81Egqt9vmL_isCat.push(v["@value"]); } - instance.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = _2xEU4QtkC53RAun67T81Egqt9vmL_isCat; - + instance.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = + _2xEU4QtkC53RAun67T81Egqt9vmL_isCat; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -23200,481 +26367,563 @@ get preferredUsernames(): ((string | LanguageString))[] { } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); - const _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + const proxy: Record = super._getCustomInspectProxy(); + const _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this + .#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername + // 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 (_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length == 1) { - proxy.preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername[0]; - } - - if (_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 1 - || !("preferredUsername" in proxy) - && _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0) { - proxy.preferredUsernames = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; - } - - const _axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey - // 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 (_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length == 1) { + proxy.preferredUsername = + _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername[0]; + } + + if ( + _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 1 || + !("preferredUsername" in proxy) && + _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length > 0 + ) { + proxy.preferredUsernames = + _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; + } + + const _axq166E2eZADq34V4MYUc8KMZdC_publicKey = this + .#_axq166E2eZADq34V4MYUc8KMZdC_publicKey + // 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 (_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length == 1) { - proxy.publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; - } - - if (_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length > 1 - || !("publicKey" in proxy) - && _axq166E2eZADq34V4MYUc8KMZdC_publicKey.length > 0) { - proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; - } - - const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod - // 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 (_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length == 1) { + proxy.publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; + } + + if ( + _axq166E2eZADq34V4MYUc8KMZdC_publicKey.length > 1 || + !("publicKey" in proxy) && + _axq166E2eZADq34V4MYUc8KMZdC_publicKey.length > 0 + ) { + proxy.publicKeys = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; + } + + const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this + .#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod + // 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 (_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length == 1) { - proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; - } - - if (_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length > 1 - || !("assertionMethod" in proxy) - && _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length > 0) { - proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; - } - - const _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers - // 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 (_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length == 1) { + proxy.assertionMethod = _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; + } + + if ( + _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length > 1 || + !("assertionMethod" in proxy) && + _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length > 0 + ) { + proxy.assertionMethods = _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + } + + const _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this + .#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers + // 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 (_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length == 1) { - proxy.manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers[0]; - } - - const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox - // 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 (_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length == 1) { + proxy.manuallyApprovesFollowers = + _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers[0]; + } + + const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this + .#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox + // 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 (_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length == 1) { - proxy.inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; - } - - const _41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox - // 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 (_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length == 1) { + proxy.inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; + } + + const _41QwhqJouoLg3h8dRPKat21brynC_outbox = this + .#_41QwhqJouoLg3h8dRPKat21brynC_outbox + // 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 (_41QwhqJouoLg3h8dRPKat21brynC_outbox.length == 1) { - proxy.outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; - } - - const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following - // 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 (_41QwhqJouoLg3h8dRPKat21brynC_outbox.length == 1) { + proxy.outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; + } + + const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this + .#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following + // 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 (_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length == 1) { - proxy.following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; - } - - const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers - // 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 (_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length == 1) { + proxy.following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; + } + + const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this + .#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers + // 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 (_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length == 1) { - proxy.followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; - } - - const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked - // 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 (_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length == 1) { + proxy.followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; + } + + const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this + .#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked + // 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 (_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length == 1) { - proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; - } - - const _4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured - // 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 (_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length == 1) { + proxy.liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; + } + + const _4N1vBJzXDf8NbBumeECQMFvKetja_featured = this + .#_4N1vBJzXDf8NbBumeECQMFvKetja_featured + // 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 (_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length == 1) { - proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; - } - - const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags - // 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 (_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length == 1) { + proxy.featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; + } + + const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this + .#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags + // 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 (_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length == 1) { - proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; - } - - const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams - // 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 (_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length == 1) { + proxy.featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; + } + + const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this + .#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams + // 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 (_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length > 1 - || !("stream" in proxy) - && _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length > 0) { - proxy.streams = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; - } - - const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints - // 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 ( + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length > 1 || + !("stream" in proxy) && + _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length > 0 + ) { + proxy.streams = _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + } + + const _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this + .#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints + // 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 (_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length == 1) { - proxy.endpoints = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[0]; - } - - const _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable - // 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 (_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length == 1) { + proxy.endpoints = _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[0]; + } + + const _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this + .#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable + // 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 (_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length == 1) { - proxy.discoverable = _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable[0]; - } - - const _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended - // 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 (_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length == 1) { + proxy.discoverable = _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable[0]; + } + + const _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this + .#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended + // 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 (_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length == 1) { - proxy.suspended = _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended[0]; - } - - const _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial - // 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 (_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length == 1) { + proxy.suspended = _2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended[0]; + } + + const _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this + .#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial + // 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 (_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length == 1) { - proxy.memorial = _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial[0]; - } - - const _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable - // 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 (_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length == 1) { + proxy.memorial = _79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial[0]; + } + + const _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this + .#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable + // 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 (_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length == 1) { - proxy.indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable[0]; - } - - const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo - // 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 (_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length == 1) { + proxy.indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable[0]; + } + + const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this + .#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo + // 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 (_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length == 1) { - proxy.successor = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; - } - - const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs - // 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 (_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length == 1) { + proxy.successor = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; + } + + const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this + .#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs + // 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 (_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length == 1) { - proxy.alias = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; - } - - if (_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length > 1 - || !("alias" in proxy) - && _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length > 0) { - proxy.aliases = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; - } - - const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service - // 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 (_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length == 1) { + proxy.alias = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; + } + + if ( + _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length > 1 || + !("alias" in proxy) && + _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length > 0 + ) { + proxy.aliases = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + } + + const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this + .#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service + // 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 (_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length == 1) { - proxy.service = _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; - } - - if (_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length > 1 - || !("service" in proxy) - && _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length > 0) { - proxy.services = _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; - } - - const _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage - // 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 (_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length == 1) { + proxy.service = _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; + } + + if ( + _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length > 1 || + !("service" in proxy) && + _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length > 0 + ) { + proxy.services = _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + } + + const _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this + .#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage + // 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 (_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length == 1) { - proxy.followedMessage = _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage[0]; - } - - const _2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat - // 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 (_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length == 1) { + proxy.followedMessage = + _QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage[0]; + } + + const _2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this + .#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat + // 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 (_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length == 1) { - proxy.cat = _2xEU4QtkC53RAun67T81Egqt9vmL_isCat[0]; - } - + [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 (_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length == 1) { + proxy.cat = _2xEU4QtkC53RAun67T81Egqt9vmL_isCat[0]; + } + return proxy; } @@ -23696,62 +26945,114 @@ get preferredUsernames(): ((string | LanguageString))[] { const proxy = this._getCustomInspectProxy(); return "Application " + inspect(proxy, options); } - } +} /** Instances of `IntransitiveActivity` are a subtype of {@link Activity} * representing intransitive actions. The `object` property is therefore * inappropriate for these activities. - * */ export class IntransitiveActivity extends Activity { + /** + * The type URI of {@link IntransitiveActivity}: `https://www.w3.org/ns/activitystreams#IntransitiveActivity`. + */ + static override get typeId(): URL { + return new URL( + "https://www.w3.org/ns/activitystreams#IntransitiveActivity", + ); + } - /** - * The type URI of {@link IntransitiveActivity}: `https://www.w3.org/ns/activitystreams#IntransitiveActivity`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#IntransitiveActivity"); - } - /** * Constructs a new instance of IntransitiveActivity 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, + 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);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -23760,51 +27061,104 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): IntransitiveActivity { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 IntransitiveActivity; + const clone = super.clone( + values, + options, + ) as unknown as IntransitiveActivity; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -23816,9 +27170,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -23826,17 +27183,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -23846,8 +27203,10 @@ instruments?: (Object | URL)[];} string, unknown[] | { "@list": unknown[] } | string >; - - values["@type"] = ["https://www.w3.org/ns/activitystreams#IntransitiveActivity"]; + + values["@type"] = [ + "https://www.w3.org/ns/activitystreams#IntransitiveActivity", + ]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { return await jsonld.expand( @@ -23856,7 +27215,11 @@ 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", + ]; const compacted = await jsonld.compact( values, docContext, @@ -23864,27 +27227,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -23899,9 +27262,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -23914,7 +27277,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__IntransitiveActivity__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -23936,15 +27302,14 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -23964,30 +27329,43 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://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 ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); } - - if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#IntransitiveActivity")) { - throw new TypeError("Invalid type: " + values["@type"]); + if ( + "@type" in values && + !values["@type"].every((t) => t.startsWith("_:")) + ) { + 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#IntransitiveActivity", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } } - } - + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -23997,7 +27375,7 @@ instruments?: (Object | URL)[];} if (!(instance instanceof IntransitiveActivity)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -24010,9 +27388,9 @@ instruments?: (Object | URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -24034,62 +27412,112 @@ instruments?: (Object | URL)[];} const proxy = this._getCustomInspectProxy(); return "IntransitiveActivity " + inspect(proxy, options); } - } +} /** An `IntransitiveActivity` that indicates that the `actor` has arrived at the `location`. * The `origin` can be used to identify the context from which the `actor` originated. * The `target` typically has no defined meaning. - * */ export class Arrive extends IntransitiveActivity { + /** + * The type URI of {@link Arrive}: `https://www.w3.org/ns/activitystreams#Arrive`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Arrive"); + } - /** - * The type URI of {@link Arrive}: `https://www.w3.org/ns/activitystreams#Arrive`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Arrive"); - } - /** * Constructs a new instance of Arrive 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, + 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);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -24098,51 +27526,101 @@ instruments?: (Object | URL)[];} * @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)[];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, - } = {} + 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; + } = {}, ): Arrive { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Arrive; + const clone = super.clone(values, options) as unknown as Arrive; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -24154,9 +27632,12 @@ instruments?: (Object | URL)[];} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -24164,17 +27645,17 @@ instruments?: (Object | URL)[];} 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'." + "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", @@ -24184,7 +27665,7 @@ instruments?: (Object | URL)[];} string, unknown[] | { "@list": unknown[] } | string >; - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Arrive"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -24194,7 +27675,11 @@ 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", + ]; const compacted = await jsonld.compact( values, docContext, @@ -24202,27 +27687,27 @@ instruments?: (Object | URL)[];} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -24237,9 +27722,9 @@ instruments?: (Object | URL)[];} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -24252,7 +27737,10 @@ instruments?: (Object | URL)[];} async (span) => { try { const object = await this.__fromJsonLd__Arrive__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -24274,15 +27762,14 @@ instruments?: (Object | URL)[];} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -24302,18 +27789,23 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://www.w3.org/ns/activitystreams#Arrive")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://www.w3.org/ns/activitystreams#Arrive", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -24323,7 +27815,7 @@ instruments?: (Object | URL)[];} if (!(instance instanceof Arrive)) { throw new TypeError("Unexpected type: " + instance.constructor.name); } - + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -24336,9 +27828,9 @@ instruments?: (Object | URL)[];} } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); + const proxy: Record = super._getCustomInspectProxy(); return proxy; } @@ -24360,18 +27852,17 @@ instruments?: (Object | URL)[];} const proxy = this._getCustomInspectProxy(); return "Arrive " + inspect(proxy, options); } - } +} /** Represents any kind of multi-paragraph written work. */ export class Article extends Object { - - /** - * The type URI of {@link Article}: `https://www.w3.org/ns/activitystreams#Article`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Article"); - } + /** + * The type URI of {@link Article}: `https://www.w3.org/ns/activitystreams#Article`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Article"); + } #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; /** @@ -24380,46 +27871,85 @@ export class Article extends Object { * @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)[];quoteUrl?: URL | null;} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + 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)[]; + 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" + ".", - ); - } - } + 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. @@ -24428,80 +27958,119 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} * @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)[];quoteUrl?: URL | null;} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + 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)[]; + quoteUrl?: URL | null; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): Article { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Article;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 Article; + 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]; - } - + + /** 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. @@ -24513,9 +28082,12 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -24523,60 +28095,70 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} 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'." + "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 - ); + const item = v.href; compactItems.push(item); } if (compactItems.length > 0) { - - result["quoteUrl"] - = compactItems.length > 1 + result["quoteUrl"] = compactItems.length > 1 + ? compactItems + : compactItems[0]; + + result["_misskey_quote"] = compactItems.length > 1 ? compactItems : compactItems[0]; - - result["_misskey_quote"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - result["quoteUri"] - = compactItems.length > 1 - ? compactItems - : compactItems[0]; - - } - + + result["quoteUri"] = compactItems.length > 1 + ? compactItems + : compactItems[0]; + } + 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", + { + "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; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - + const baseValues = await super.toJsonLd({ ...options, format: "expand", @@ -24586,26 +28168,21 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} string, unknown[] | { "@list": unknown[] } | string >; - + array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { - const element = ( - { "@value": v.href } - ); - array.push(element);; + const element = { "@value": v.href }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + 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["https://misskey-hub.net/ns#_misskey_quote"] = propValue; + + values["http://fedibird.com/ns#quoteUri"] = propValue; } - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Article"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -24615,7 +28192,25 @@ 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", + { + "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, @@ -24623,27 +28218,27 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -24658,9 +28253,9 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise
{ const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -24673,7 +28268,10 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} async (span) => { try { const object = await this.__fromJsonLd__Article__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -24695,15 +28293,14 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise
{ if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -24723,18 +28320,23 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://www.w3.org/ns/activitystreams#Article")) { - throw new TypeError("Invalid type: " + values["@type"]); + + 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://www.w3.org/ns/activitystreams#Article", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } + } + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -24746,28 +28348,39 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} } 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"]; - } - + 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.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"])) + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(new URL(v["@value"])); } - instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; - + instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = + _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -24780,29 +28393,32 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} } 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 + 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]; - } - + [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; } @@ -24824,20 +28440,19 @@ proofs?: (DataIntegrityProof | URL)[];quoteUrl?: URL | null;} const proxy = this._getCustomInspectProxy(); return "Article " + inspect(proxy, options); } - } +} /** Represents a document of any kind. */ export class Document extends Object { - - /** - * The type URI of {@link Document}: `https://www.w3.org/ns/activitystreams#Document`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Document"); - } + /** + * The type URI of {@link Document}: `https://www.w3.org/ns/activitystreams#Document`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Document"); + } #_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width: (number)[] = []; -#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height: (number)[] = []; + #_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height: (number)[] = []; /** * Constructs a new instance of Document with the given values. @@ -24845,58 +28460,104 @@ export class Document extends Object { * @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)[];width?: number | null;height?: number | null;} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + 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)[]; + width?: number | null; + height?: number | null; + }, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - super(values, options); - if ("width" in values && values.width != null) { - if (typeof values.width === "number" && Number.isInteger(values.width) && values.width >= 0) { - // @ts-ignore: type is checked above. - this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = [values.width]; - } else { - throw new TypeError( - "The width must be of type " + - "number" + ".", - ); - } - } - - if ("height" in values && values.height != null) { - if (typeof values.height === "number" && Number.isInteger(values.height) && values.height >= 0) { - // @ts-ignore: type is checked above. - this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = [values.height]; - } else { - throw new TypeError( - "The height must be of type " + - "number" + ".", - ); - } - } + super(values, options); + if ("width" in values && values.width != null) { + if ( + typeof values.width === "number" && Number.isInteger(values.width) && + values.width >= 0 + ) { + // @ts-ignore: type is checked above. + this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = [values.width]; + } else { + throw new TypeError( + "The width must be of type " + + "number" + ".", + ); } + } + + if ("height" in values && values.height != null) { + if ( + typeof values.height === "number" && Number.isInteger(values.height) && + values.height >= 0 + ) { + // @ts-ignore: type is checked above. + this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = [values.height]; + } else { + throw new TypeError( + "The height must be of type " + + "number" + ".", + ); + } + } + } /** * Clones this instance, optionally updating it with the given values. @@ -24905,99 +28566,145 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu * @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)[];width?: number | null;height?: number | null;} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + 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)[]; + width?: number | null; + height?: number | null; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): Document { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; - if ("width" in values && values.width != null) { - if (typeof values.width === "number" && Number.isInteger(values.width) && values.width >= 0) { - // @ts-ignore: type is checked above. - clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = [values.width]; - } else { - throw new TypeError( - "The width must be of type " + - "number" + ".", - ); - } - } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height; - if ("height" in values && values.height != null) { - if (typeof values.height === "number" && Number.isInteger(values.height) && values.height >= 0) { - // @ts-ignore: type is checked above. - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = [values.height]; - } else { - throw new TypeError( - "The height must be of type " + - "number" + ".", - ); - } - } - - return clone; - } - -/** Specifies a hint as to the rendering width in - * device-independent pixels of the linked resource. - * - */ - get width(): (number | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < 1) return null; - return this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width[0]; + const clone = super.clone(values, options) as unknown as Document; + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = + this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; + if ("width" in values && values.width != null) { + if ( + typeof values.width === "number" && Number.isInteger(values.width) && + values.width >= 0 + ) { + // @ts-ignore: type is checked above. + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = [values.width]; + } else { + throw new TypeError( + "The width must be of type " + + "number" + ".", + ); } - -/** Specifies a hint as to the rendering height in - * device-independent pixels of the linked resource. - * - */ - get height(): (number | null) { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - } - if (this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < 1) return null; - return this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height[0]; + } + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = + this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height; + if ("height" in values && values.height != null) { + if ( + typeof values.height === "number" && Number.isInteger(values.height) && + values.height >= 0 + ) { + // @ts-ignore: type is checked above. + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = [values.height]; + } else { + throw new TypeError( + "The height must be of type " + + "number" + ".", + ); } - + } + + return clone; + } + + /** Specifies a hint as to the rendering width in + * device-independent pixels of the linked resource. + */ + get width(): number | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < 1) return null; + return this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width[0]; + } + + /** Specifies a hint as to the rendering height in + * device-independent pixels of the linked resource. + */ + get height(): number | null { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values, + ); + } + if (this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < 1) return null; + return this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height[0]; + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -25009,9 +28716,12 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -25019,66 +28729,58 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu 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'." + "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.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["width"] - = compactItems.length > 1 + result["width"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + compactItems = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { - const item = ( - v - ); + const item = v; compactItems.push(item); } if (compactItems.length > 0) { - - result["height"] - = compactItems.length > 1 + result["height"] = compactItems.length > 1 ? compactItems : compactItems[0]; - } - + 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", + ]; return result; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - + const baseValues = await super.toJsonLd({ ...options, format: "expand", @@ -25088,43 +28790,33 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu string, unknown[] | { "@list": unknown[] } | string >; - + array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", "@value": v, - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#width"] = propValue; - } - + array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { - const element = ( - { + const element = { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", "@value": v, - } - ); - array.push(element);; + }; + array.push(element); } if (array.length > 0) { - const propValue = ( - array - ); + const propValue = array; values["https://www.w3.org/ns/activitystreams#height"] = propValue; - } - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Document"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -25134,7 +28826,10 @@ 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", + ]; const compacted = await jsonld.compact( values, docContext, @@ -25142,27 +28837,27 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -25177,9 +28872,9 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { const tracerProvider = options.tracerProvider ?? trace.getTracerProvider(); @@ -25192,7 +28887,10 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu async (span) => { try { const object = await this.__fromJsonLd__Document__( - json, span, options); + json, + span, + options, + ); if (object.id != null) { span.setAttribute("activitypub.object.id", object.id.href); } @@ -25214,15 +28912,14 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu json: unknown, span: Span, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise { if (typeof json === "undefined") { throw new TypeError("Invalid JSON-LD: undefined."); - } - else if (json === null) throw new TypeError("Invalid JSON-LD: null."); + } else if (json === null) throw new TypeError("Invalid JSON-LD: null."); options = { ...options, documentLoader: options.documentLoader ?? getDocumentLoader(), @@ -25242,34 +28939,47 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - - 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://www.w3.org/ns/activitystreams#Audio")) { - return await Audio.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Image")) { - return await Image.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Page")) { - return await Page.fromJsonLd(json, options); - } - - if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Video")) { - return await Video.fromJsonLd(json, options); + + if ("@type" in values) { + span.setAttribute("activitypub.object.type", values["@type"]); } - - if (!values["@type"].includes("https://www.w3.org/ns/activitystreams#Document")) { - throw new TypeError("Invalid type: " + values["@type"]); + if ( + "@type" in values && + !values["@type"].every((t) => t.startsWith("_:")) + ) { + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Audio") + ) { + return await Audio.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Image") + ) { + return await Image.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Page") + ) { + return await Page.fromJsonLd(json, options); + } + + if ( + values["@type"].includes("https://www.w3.org/ns/activitystreams#Video") + ) { + return await Video.fromJsonLd(json, options); + } + + if ( + !values["@type"].includes( + "https://www.w3.org/ns/activitystreams#Document", + ) + ) { + throw new TypeError("Invalid type: " + values["@type"]); + } } - } - + delete values["@type"]; const instance = await super.fromJsonLd(values, { ...options, @@ -25281,35 +28991,41 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu } const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width: (number)[] = []; - let _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array = values["https://www.w3.org/ns/activitystreams#width"]; - + let _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array = + values["https://www.w3.org/ns/activitystreams#width"]; + for ( const v of _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array == null ? [] - : _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array.length === 1 && "@list" in _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array[0] + : _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array.length === 1 && + "@list" in _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array[0] ? _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array[0]["@list"] : _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width__array ) { if (v == null) continue; - _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.push(v["@value"]) + _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.push(v["@value"]); } - instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; + instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = + _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; const _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height: (number)[] = []; - let _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array = values["https://www.w3.org/ns/activitystreams#height"]; - + let _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array = + values["https://www.w3.org/ns/activitystreams#height"]; + for ( const v of _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array == null ? [] - : _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array.length === 1 && "@list" in _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array[0] + : _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array.length === 1 && + "@list" in _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array[0] ? _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array[0]["@list"] : _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height__array ) { if (v == null) continue; - _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.push(v["@value"]) + _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.push(v["@value"]); } - instance.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height; - + instance.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = + _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height; + if (!("_fromSubclass" in options) || !options._fromSubclass) { try { instance._cachedJsonLd = structuredClone(json); @@ -25322,49 +29038,55 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu } return instance; } - + protected override _getCustomInspectProxy(): Record { - const proxy: Record = super._getCustomInspectProxy(); - const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width - // deno-lint-ignore no-explicit-any - .map((v: any) => v instanceof URL + const proxy: Record = super._getCustomInspectProxy(); + const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this + .#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width + // 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 (_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length == 1) { - proxy.width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width[0]; - } - - const _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height - // 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 (_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length == 1) { + proxy.width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width[0]; + } + + const _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this + .#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height + // 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 (_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length == 1) { - proxy.height = _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height[0]; - } - + [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 (_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length == 1) { + proxy.height = _2cGKFeFJMmiNpGZFEF75mCwFQsKb_height[0]; + } + return proxy; } @@ -25386,53 +29108,93 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu const proxy = this._getCustomInspectProxy(); return "Document " + inspect(proxy, options); } - } +} /** Represents an audio document of any kind. */ export class Audio extends Document { + /** + * The type URI of {@link Audio}: `https://www.w3.org/ns/activitystreams#Audio`. + */ + static override get typeId(): URL { + return new URL("https://www.w3.org/ns/activitystreams#Audio"); + } - /** - * The type URI of {@link Audio}: `https://www.w3.org/ns/activitystreams#Audio`. - */ - static override get typeId(): URL { - return new URL("https://www.w3.org/ns/activitystreams#Audio"); - } - /** * Constructs a new instance of Audio 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)[];width?: number | null;height?: number | null;} -, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + 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)[]; + width?: number | null; + height?: number | null; + }, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ) { - super(values, options);} + super(values, options); + } /** * Clones this instance, optionally updating it with the given values. @@ -25441,45 +29203,84 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu * @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)[];width?: number | null;height?: number | null;} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - } = {} + 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)[]; + width?: number | null; + height?: number | null; + } = {}, + options: { + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + } = {}, ): Audio { if (this._warning != null) { getLogger(this._warning.category).warn( this._warning.message, - this._warning.values + 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 Audio; + const clone = super.clone(values, options) as unknown as Audio; return clone; } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -25491,9 +29292,12 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu * @returns The JSON-LD representation of this object. */ override async toJsonLd(options: { - format?: "compact" | "expand", - contextLoader?: DocumentLoader, - context?: string | Record | (string | Record)[], + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; } = {}): Promise { if (options.format == null && this._cachedJsonLd != null) { return this._cachedJsonLd; @@ -25501,34 +29305,36 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu 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'." + "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"] = "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", + ]; return result; } - + // deno-lint-ignore no-unused-vars prefer-const let array: unknown[]; - + const baseValues = await super.toJsonLd({ ...options, format: "expand", @@ -25538,7 +29344,7 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu string, unknown[] | { "@list": unknown[] } | string >; - + values["@type"] = ["https://www.w3.org/ns/activitystreams#Audio"]; if (this.id != null) values["@id"] = this.id.href; if (options.format === "expand") { @@ -25548,7 +29354,10 @@ 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", + ]; const compacted = await jsonld.compact( values, docContext, @@ -25556,27 +29365,27 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu ); if (docContext != null) { // Embed context - - if ("proof" in compacted && - compacted.proof != null) { + + 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; + 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. @@ -25591,9 +29400,9 @@ proofs?: (DataIntegrityProof | URL)[];width?: number | null;height?: number | nu static override async fromJsonLd( json: unknown, options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, + documentLoader?: DocumentLoader; + contextLoader?: DocumentLoader; + tracerProvider?: TracerProvider; } = {}, ): Promise