UNPKG

@fedify/fedify

Version:

An ActivityPub server framework

1,094 lines • 2.27 MB
var _a, _b, _c, _d, _e, _f, _g, _h; // deno-lint-ignore-file ban-unused-ignore prefer-const import * as dntShim from "../_dnt.shims.js"; // @ts-ignore TS7016 import jsonld from "jsonld"; import { getLogger } from "@logtape/logtape"; import { SpanStatusCode, trace, } from "@opentelemetry/api"; import { LanguageTag, parseLanguageTag } from "@phensley/language-tag"; import { decode as decodeMultibase, encode as encodeMultibase, } from "../runtime/multibase/index.js"; import { getDocumentLoader, } from "../runtime/docloader.js"; import { exportMultibaseKey, exportSpki, importMultibaseKey, importPem, } from "../runtime/key.js"; import { LanguageString } from "../runtime/langstr.js"; /** 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 { #documentLoader; #contextLoader; #tracerProvider; #warning; #cachedJsonLd; id; get _documentLoader() { return this.#documentLoader; } get _contextLoader() { return this.#contextLoader; } get _tracerProvider() { return this.#tracerProvider; } get _warning() { return this.#warning; } get _cachedJsonLd() { return this.#cachedJsonLd; } set _cachedJsonLd(value) { this.#cachedJsonLd = value; } /** * The type URI of {@link Object}: `https://www.w3.org/ns/activitystreams#Object`. */ static get typeId() { return new URL("https://www.w3.org/ns/activitystreams#Object"); } #_49BipA5dq9eoH8LX8xdsVumveTca_attachment = []; #_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = []; #_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = []; #_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = []; #_3mhZzGXSpQ431mBSz2kvych22v4e_context = []; #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = []; #_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = []; #_86xFhmgBapoMvYqjbjRuDPayTrS_generator = []; #_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = []; #_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = []; #_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = []; #_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = []; #_gCVTegXxWWCw6wWRxa1QF65zusg_preview = []; #_5e258TDXtuhaFRPZiGoDfEpjdMr_published = []; #_7UpwM3JWcXhADcscukEehBorf6k_replies = []; #_3kAfck9PcEYt2L7xug5y99YPbANs_shares = []; #_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = []; #_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = []; #_2w3Jmue4up8iVDUA51WZqomEF438_startTime = []; #_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = []; #_5chuqj6s95p5gg2sk1HntGfarRf_tag = []; #_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = []; #_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = []; #_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = []; #_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = []; #_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = []; #_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = []; #_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = []; #_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = []; #_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = []; #_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = []; #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = []; /** * Constructs a new instance of Object with the given values. * @param values The values to initialize the instance with. * @param options The options to use for initialization. */ constructor(values, options = {}) { this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; if ("$warning" in options) { this.#warning = options.$warning; } if (values.id == null || values.id instanceof URL) { this.id = values.id ?? null; } 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 _a || 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 _a || 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 _a || 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 _a || 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 dntShim.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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 dntShim.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 dntShim.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 _a || 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 dntShim.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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 dntShim.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 = {}, options = {}) { 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 = 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 _a || 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 _a || 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 _a || 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 _a || 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 dntShim.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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 _a || 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 dntShim.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