diff --git a/CHANGES.md b/CHANGES.md index bc411e117..9b58f6fc6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -341,6 +341,42 @@ To be released. [#489]: https://github.com/fedify-dev/fedify/issues/489 +### @fedify/vocab-runtime + + - Added `PropertyPreprocessor`, `PropertyPreprocessorContext`, and `Json` + types for normalizing wire-level JSON-LD property values before the + generated range decoder runs. [[#792]] + +[#792]: https://github.com/fedify-dev/fedify/issues/792 + +### @fedify/vocab + + - Explicit ActivityStreams `Link` objects in `icon` and `image` properties + are now normalized to `Image` during decoding via the new exported + `normalizeLinkToImage()` preprocessor. The public `Image`-oriented + TypeScript API is unchanged. [[#790], [#792]] + + - The generated `fromJsonLd()` methods no longer resolve blank node + identifiers (`_:b0`) against `options.baseUrl`; blank nodes are left + as `null` in the resulting instance's `id` field. [[#792]] + +[#790]: https://github.com/fedify-dev/fedify/issues/790 + +### @fedify/vocab-tools + + - Property schemas now support a `preprocessors` field that lists + module/function pairs. Generated decoders dynamically import and run + these preprocessors for each expanded JSON-LD property value before + falling back to the normal range decoder. [[#792]] + + - The generated base class now stores the `baseUrl` from `fromJsonLd()` + as a protected `_baseUrl` field. This URL is used to resolve + relative URIs when cached embedded property documents are re-parsed + lazily by accessors like `getIcon()`, so that callers do not need to + pass an explicit `baseUrl`. The stored URL is defensively copied so + that mutation of the caller's original `URL` object does not affect + later resolution. [[#792]] + Version 2.2.5 ------------- diff --git a/docs/.gitignore b/docs/.gitignore index 8b7451b4e..aa5196e2a 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,4 +1,5 @@ .jsr-cache.json +.jsr-cache-*.json .jsr-*-cache.json .vitepress/cache/ .vitepress/dist/ diff --git a/packages/cli/src/lookup.test.ts b/packages/cli/src/lookup.test.ts index ae9541916..2c3b6dfe7 100644 --- a/packages/cli/src/lookup.test.ts +++ b/packages/cli/src/lookup.test.ts @@ -35,6 +35,12 @@ import { writeSeparator, } from "./lookup.ts"; +const testRuntime = "Bun" in globalThis ? "bun" : "node"; + +function getTestOutputDir(name: string): string { + return `./test_output_${testRuntime}_${name}`; +} + async function parseWithConfig( parser: Parser<"sync", TValue, TState>, args: readonly string[], @@ -54,7 +60,7 @@ async function parseWithConfig( } test("writeObjectToStream - writes Note object with default options", async () => { - const testDir = "./test_output_note"; + const testDir = getTestOutputDir("note"); const testFile = `${testDir}/note.txt`; await mkdir(testDir, { recursive: true }); @@ -78,7 +84,7 @@ test("writeObjectToStream - writes Note object with default options", async () = }); test("writeObjectToStream - writes Activity object in raw JSON-LD format", async () => { - const testDir = "./test_output_activity"; + const testDir = getTestOutputDir("activity"); const testFile = `${testDir}/raw.json`; await mkdir(testDir, { recursive: true }); @@ -102,7 +108,7 @@ test("writeObjectToStream - writes Activity object in raw JSON-LD format", async }); test("writeObjectToStream - writes object in compact JSON-LD format", async () => { - const testDir = "./test_output_compact"; + const testDir = getTestOutputDir("compact"); const testFile = `${testDir}/compact.json`; await mkdir(testDir, { recursive: true }); @@ -125,7 +131,7 @@ test("writeObjectToStream - writes object in compact JSON-LD format", async () = }); test("writeObjectToStream - writes object in expanded JSON-LD format", async () => { - const testDir = "./test_output_expand"; + const testDir = getTestOutputDir("expand"); const testFile = `${testDir}/expand.json`; await mkdir(testDir, { recursive: true }); @@ -147,7 +153,7 @@ test("writeObjectToStream - writes object in expanded JSON-LD format", async () }); test("writeObjectToStream - supports reusing an output stream", async () => { - const testDir = "./test_output_reused_stream"; + const testDir = getTestOutputDir("reused_stream"); const testFile = `${testDir}/notes.txt`; await mkdir(testDir, { recursive: true }); @@ -181,7 +187,7 @@ test("writeObjectToStream - supports reusing an output stream", async () => { }); test("writeSeparator - writes to provided output stream", async () => { - const testDir = "./test_output_separator"; + const testDir = getTestOutputDir("separator"); const testFile = `${testDir}/separator.txt`; await mkdir(testDir, { recursive: true }); @@ -244,7 +250,7 @@ test("writeObjectToStream - writes to stdout when no output file specified", asy }); test("writeObjectToStream - handles empty content properly", async () => { - const testDir = "./test_output_empty"; + const testDir = getTestOutputDir("empty"); const testFile = `${testDir}/empty.txt`; await mkdir(testDir, { recursive: true }); @@ -1191,7 +1197,7 @@ async function withRecursiveLookupServer( } test("runLookup - rejects recursive private targets by default", async () => { - const testDir = "./test_output_runlookup_recurse_private_default"; + const testDir = getTestOutputDir("runlookup_recurse_private_default"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1226,7 +1232,7 @@ test("runLookup - rejects recursive private targets by default", async () => { }); test("runLookup - allows recursive private targets with allowPrivateAddress", async () => { - const testDir = "./test_output_runlookup_recurse_private_allowed"; + const testDir = getTestOutputDir("runlookup_recurse_private_allowed"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1258,7 +1264,7 @@ test("runLookup - allows recursive private targets with allowPrivateAddress", as }); test("runLookup - keeps recursive private contexts blocked", async () => { - const testDir = "./test_output_runlookup_recurse_private_context"; + const testDir = getTestOutputDir("runlookup_recurse_private_context"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1293,7 +1299,7 @@ test("runLookup - keeps recursive private contexts blocked", async () => { }); test("runLookup - reverses output order in default multi-input mode", async () => { - const testDir = "./test_output_runlookup_default_reverse"; + const testDir = getTestOutputDir("runlookup_default_reverse"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1349,7 +1355,7 @@ test("runLookup - reverses output order in default multi-input mode", async () = }); test("runLookup - reverses output order in recurse mode", async () => { - const testDir = "./test_output_runlookup_recurse_reverse"; + const testDir = getTestOutputDir("runlookup_recurse_reverse"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1412,7 +1418,7 @@ test("runLookup - reverses output order in recurse mode", async () => { }); test("runLookup - reverses output order in traverse mode", async () => { - const testDir = "./test_output_runlookup_traverse_reverse"; + const testDir = getTestOutputDir("runlookup_traverse_reverse"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1455,7 +1461,9 @@ test("runLookup - reverses output order in traverse mode", async () => { }); test("runLookup - emits reversed partial items on traverse reverse failure", async () => { - const testDir = "./test_output_runlookup_traverse_reverse_partial_failure"; + const testDir = getTestOutputDir( + "runlookup_traverse_reverse_partial_failure", + ); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { @@ -1503,7 +1511,7 @@ test("runLookup - emits reversed partial items on traverse reverse failure", asy }); test("runLookup - writes separators between adjacent traversed items", async () => { - const testDir = "./test_output_runlookup_traverse_separator"; + const testDir = getTestOutputDir("runlookup_traverse_separator"); const testFile = `${testDir}/out.jsonl`; const separator = ""; await mkdir(testDir, { recursive: true }); @@ -1566,7 +1574,7 @@ test("runLookup - writes separators between adjacent traversed items", async () test( "runLookup - writes separators between adjacent traversed items in reverse mode", async () => { - const testDir = "./test_output_runlookup_traverse_separator_reverse"; + const testDir = getTestOutputDir("runlookup_traverse_separator_reverse"); const testFile = `${testDir}/out.jsonl`; const separator = ""; await mkdir(testDir, { recursive: true }); @@ -1629,7 +1637,7 @@ test( ); test("runLookup - emits root object on recurse reverse failure", async () => { - const testDir = "./test_output_runlookup_recurse_reverse_partial_failure"; + const testDir = getTestOutputDir("runlookup_recurse_reverse_partial_failure"); const testFile = `${testDir}/out.jsonl`; await mkdir(testDir, { recursive: true }); try { diff --git a/packages/fedify/src/federation/handler.ts b/packages/fedify/src/federation/handler.ts index 78c9fbcef..83c18831e 100644 --- a/packages/fedify/src/federation/handler.ts +++ b/packages/fedify/src/federation/handler.ts @@ -132,7 +132,7 @@ function isInvalidJsonLdError(error: unknown): error is Error { function isValidationTypeError(error: unknown): error is TypeError { return error instanceof TypeError && - (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:)/ + (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:|Invalid @id:)/ .test(error.message) || isInvalidUrlTypeError(error)); } diff --git a/packages/fedify/src/federation/middleware.ts b/packages/fedify/src/federation/middleware.ts index a29891a77..d38a17a45 100644 --- a/packages/fedify/src/federation/middleware.ts +++ b/packages/fedify/src/federation/middleware.ts @@ -410,7 +410,7 @@ function isPermanentInboxParseError(error: unknown): error is Error { (error.name === "jsonld.SyntaxError" && !isRemoteContextLoadingFailure(error)))) || (error instanceof TypeError && - (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:)/ + (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:|Invalid @id:)/ .test(error.message) || isInvalidUrlTypeError(error))); } diff --git a/packages/vocab-runtime/src/mod.ts b/packages/vocab-runtime/src/mod.ts index 1a6bda9e7..9e7967c9e 100644 --- a/packages/vocab-runtime/src/mod.ts +++ b/packages/vocab-runtime/src/mod.ts @@ -44,6 +44,11 @@ export { type GetUserAgentOptions, logRequest, } from "./request.ts"; +export { + type Json, + type PropertyPreprocessor, + type PropertyPreprocessorContext, +} from "./preprocessor.ts"; export { expandIPv6Address, isValidPublicIPv4Address, diff --git a/packages/vocab-runtime/src/preprocessor.ts b/packages/vocab-runtime/src/preprocessor.ts new file mode 100644 index 000000000..1151ee31d --- /dev/null +++ b/packages/vocab-runtime/src/preprocessor.ts @@ -0,0 +1,43 @@ +import type { DocumentLoader } from "./docloader.ts"; +import type { TracerProvider } from "@opentelemetry/api"; + +/** + * JSON value shape passed to property preprocessors. + * @since 2.3.0 + */ +export type Json = + | string + | number + | boolean + | null + | readonly Json[] + | { readonly [key: string]: Json }; + +/** + * Runtime context provided to property preprocessors. + * @since 2.3.0 + */ +export interface PropertyPreprocessorContext { + /** Loader for remote JSON-LD documents. */ + documentLoader?: DocumentLoader; + /** Loader for remote JSON-LD contexts. */ + contextLoader?: DocumentLoader; + /** OpenTelemetry tracer provider for instrumentation. */ + tracerProvider?: TracerProvider; + /** Base URL for resolving relative references. */ + baseUrl?: URL; +} + +/** + * Function signature for schema-configured property preprocessors. + * + * Receives an expanded JSON-LD property value and returns a vocabulary + * object when the value is handled, `undefined` when the value should + * fall through to the normal range decoder, or an `Error` when the value + * is recognized but cannot be converted. + * @since 2.3.0 + */ +export type PropertyPreprocessor = ( + value: Json, + context: PropertyPreprocessorContext, +) => T | undefined | Error | Promise; diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap index e258d526d..56d2bb229 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap @@ -1,7 +1,7 @@ export const snapshot = {}; snapshot[`generateClasses() 1`] = ` -"// deno-lint-ignore-file ban-unused-ignore no-unused-vars prefer-const verbatim-module-syntax +"// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax import jsonld from \\"@fedify/vocab-runtime/jsonld\\"; import { getLogger } from \\"@logtape/logtape\\"; import { type Span, SpanStatusCode, type TracerProvider, trace } @@ -28,6 +28,8 @@ import { } from \\"@fedify/vocab-runtime/temporal\\"; +import * as _ppM0 from \\"./preprocessors.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}, @@ -46,6 +48,7 @@ export class Object { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -75,6 +78,10 @@ export class Object { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Object}: \`https://www.w3.org/ns/activitystreams#Object\`. @@ -203,6 +210,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -2334,7 +2343,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"attachment\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attachment_fromJsonLd(obj, options); + + v = await this.#attachment_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2588,7 +2603,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"attributedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#attribution_fromJsonLd(doc, options); + + v = await this.#attribution_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2684,7 +2705,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"attributedTo\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attribution_fromJsonLd(obj, options); + + v = await this.#attribution_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2901,7 +2928,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"audience\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#audience_fromJsonLd(doc, options); + + v = await this.#audience_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2996,7 +3029,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"audience\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#audience_fromJsonLd(obj, options); + + v = await this.#audience_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3257,7 +3296,13 @@ get contents(): ((string | LanguageString))[] { \\"context\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#context_fromJsonLd(obj, options); + + v = await this.#context_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3525,7 +3570,13 @@ get names(): ((string | LanguageString))[] { \\"generator\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#generator_fromJsonLd(obj, options); + + v = await this.#generator_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3663,6 +3714,27 @@ get names(): ((string | LanguageString))[] { this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; + if (jsonLd != null && typeof jsonLd === \\"object\\") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + + { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as Image; + } + + } + } + try { return await Image.fromJsonLd( jsonLd, @@ -3743,7 +3815,13 @@ get names(): ((string | LanguageString))[] { \\"icon\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#icon_fromJsonLd(doc, options); + + v = await this.#icon_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3839,7 +3917,13 @@ get names(): ((string | LanguageString))[] { \\"icon\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#icon_fromJsonLd(obj, options); + + v = await this.#icon_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3977,6 +4061,27 @@ get names(): ((string | LanguageString))[] { this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; + if (jsonLd != null && typeof jsonLd === \\"object\\") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + + { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as Image; + } + + } + } + try { return await Image.fromJsonLd( jsonLd, @@ -4057,7 +4162,13 @@ get names(): ((string | LanguageString))[] { \\"image\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#image_fromJsonLd(doc, options); + + v = await this.#image_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4153,7 +4264,13 @@ get names(): ((string | LanguageString))[] { \\"image\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#image_fromJsonLd(obj, options); + + v = await this.#image_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4379,7 +4496,13 @@ get names(): ((string | LanguageString))[] { \\"inReplyTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#replyTarget_fromJsonLd(doc, options); + + v = await this.#replyTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4474,7 +4597,13 @@ get names(): ((string | LanguageString))[] { \\"inReplyTo\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#replyTarget_fromJsonLd(obj, options); + + v = await this.#replyTarget_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4700,7 +4829,13 @@ get names(): ((string | LanguageString))[] { \\"location\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#location_fromJsonLd(doc, options); + + v = await this.#location_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4795,7 +4930,13 @@ get names(): ((string | LanguageString))[] { \\"location\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#location_fromJsonLd(obj, options); + + v = await this.#location_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5020,7 +5161,13 @@ get names(): ((string | LanguageString))[] { \\"preview\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#preview_fromJsonLd(doc, options); + + v = await this.#preview_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5114,7 +5261,13 @@ get names(): ((string | LanguageString))[] { \\"preview\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#preview_fromJsonLd(obj, options); + + v = await this.#preview_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5344,7 +5497,13 @@ get names(): ((string | LanguageString))[] { \\"replies\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#replies_fromJsonLd(doc, options); + + v = await this.#replies_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5566,7 +5725,13 @@ get names(): ((string | LanguageString))[] { \\"shares\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#shares_fromJsonLd(doc, options); + + v = await this.#shares_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5788,7 +5953,13 @@ get names(): ((string | LanguageString))[] { \\"likes\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likes_fromJsonLd(doc, options); + + v = await this.#likes_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6004,7 +6175,13 @@ get names(): ((string | LanguageString))[] { \\"emojiReactions\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#emojiReactions_fromJsonLd(doc, options); + + v = await this.#emojiReactions_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6272,7 +6449,13 @@ get summaries(): ((string | LanguageString))[] { \\"tag\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#tag_fromJsonLd(obj, options); + + v = await this.#tag_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6523,7 +6706,13 @@ get urls(): ((URL | Link))[] { \\"to\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#to_fromJsonLd(doc, options); + + v = await this.#to_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6618,7 +6807,13 @@ get urls(): ((URL | Link))[] { \\"to\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#to_fromJsonLd(obj, options); + + v = await this.#to_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6835,7 +7030,13 @@ get urls(): ((URL | Link))[] { \\"bto\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#bto_fromJsonLd(doc, options); + + v = await this.#bto_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6930,7 +7131,13 @@ get urls(): ((URL | Link))[] { \\"bto\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#bto_fromJsonLd(obj, options); + + v = await this.#bto_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7147,7 +7354,13 @@ get urls(): ((URL | Link))[] { \\"cc\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#cc_fromJsonLd(doc, options); + + v = await this.#cc_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7242,7 +7455,13 @@ get urls(): ((URL | Link))[] { \\"cc\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#cc_fromJsonLd(obj, options); + + v = await this.#cc_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7459,7 +7678,13 @@ get urls(): ((URL | Link))[] { \\"bcc\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#bcc_fromJsonLd(doc, options); + + v = await this.#bcc_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7554,7 +7779,13 @@ get urls(): ((URL | Link))[] { \\"bcc\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#bcc_fromJsonLd(obj, options); + + v = await this.#bcc_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7834,7 +8065,13 @@ get urls(): ((URL | Link))[] { \\"proof\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#proof_fromJsonLd(doc, options); + + v = await this.#proof_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7928,7 +8165,13 @@ get urls(): ((URL | Link))[] { \\"proof\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#proof_fromJsonLd(obj, options); + + v = await this.#proof_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8184,7 +8427,13 @@ get urls(): ((URL | Link))[] { \\"likeAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likeAuthorization_fromJsonLd(doc, options); + + v = await this.#likeAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8400,7 +8649,13 @@ get urls(): ((URL | Link))[] { \\"replyAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#replyAuthorization_fromJsonLd(doc, options); + + v = await this.#replyAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8616,7 +8871,13 @@ get urls(): ((URL | Link))[] { \\"announceAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#announceAuthorization_fromJsonLd(doc, options); + + v = await this.#announceAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -10164,7 +10425,10 @@ get urls(): ((URL | Link))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -10432,7 +10696,7 @@ get urls(): ((URL | Link))[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); @@ -10465,16 +10729,28 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\") ? await PropertyValue.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10511,23 +10787,43 @@ get urls(): ((URL | Link))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10562,7 +10858,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.push(decoded); @@ -10622,12 +10922,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10711,12 +11019,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10739,6 +11055,32 @@ get urls(): ((URL | Link))[] { ) { if (v == null) continue; + { + let _handled: Image | undefined; + + if (_handled === undefined) { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)), + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as Image; + } + } + + if (_handled !== undefined) { + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(_handled); + continue; + } + } + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push( @@ -10751,7 +11093,11 @@ get urls(): ((URL | Link))[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(decoded); @@ -10772,6 +11118,32 @@ get urls(): ((URL | Link))[] { ) { if (v == null) continue; + { + let _handled: Image | undefined; + + if (_handled === undefined) { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)), + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as Image; + } + } + + if (_handled !== undefined) { + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(_handled); + continue; + } + } + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push( @@ -10784,7 +11156,11 @@ get urls(): ((URL | Link))[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(decoded); @@ -10820,12 +11196,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10863,12 +11247,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10906,12 +11298,20 @@ get urls(): ((URL | Link))[] { && 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10968,7 +11368,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _7UpwM3JWcXhADcscukEehBorf6k_replies.push(decoded); @@ -11001,7 +11405,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3kAfck9PcEYt2L7xug5y99YPbANs_shares.push(decoded); @@ -11034,7 +11442,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.push(decoded); @@ -11067,7 +11479,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.push(decoded); @@ -11149,12 +11565,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -11213,13 +11637,25 @@ get urls(): ((URL | Link))[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))) : typeof v === \\"object\\" && \\"@type\\" in v + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -11254,7 +11690,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.push(decoded); @@ -11287,7 +11727,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.push(decoded); @@ -11320,7 +11764,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.push(decoded); @@ -11353,7 +11801,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.push(decoded); @@ -11428,7 +11880,11 @@ get urls(): ((URL | Link))[] { const decoded = await Source.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.push(decoded); @@ -11461,7 +11917,11 @@ get urls(): ((URL | Link))[] { const decoded = await DataIntegrityProof.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.push(decoded); @@ -11482,7 +11942,11 @@ get urls(): ((URL | Link))[] { const decoded = await InteractionPolicy.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.push(decoded); @@ -11514,9 +11978,17 @@ get urls(): ((URL | Link))[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.push(decoded); } @@ -11548,7 +12020,11 @@ get urls(): ((URL | Link))[] { const decoded = await LikeAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push(decoded); @@ -11581,7 +12057,11 @@ get urls(): ((URL | Link))[] { const decoded = await ReplyAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push(decoded); @@ -11614,7 +12094,11 @@ get urls(): ((URL | Link))[] { const decoded = await AnnounceAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(decoded); @@ -12792,7 +13276,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -13229,7 +13716,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -13468,7 +13961,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -13790,7 +14289,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -13841,7 +14343,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -13900,7 +14406,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -14846,7 +15356,13 @@ instruments?: (Object | URL)[];} \\"actor\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#actor_fromJsonLd(doc, options); + + v = await this.#actor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -14942,7 +15458,13 @@ instruments?: (Object | URL)[];} \\"actor\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#actor_fromJsonLd(obj, options); + + v = await this.#actor_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15160,7 +15682,13 @@ instruments?: (Object | URL)[];} \\"object\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#object_fromJsonLd(doc, options); + + v = await this.#object_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15256,7 +15784,13 @@ instruments?: (Object | URL)[];} \\"object\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#object_fromJsonLd(obj, options); + + v = await this.#object_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15477,7 +16011,13 @@ instruments?: (Object | URL)[];} \\"target\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#target_fromJsonLd(doc, options); + + v = await this.#target_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15576,7 +16116,13 @@ instruments?: (Object | URL)[];} \\"target\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#target_fromJsonLd(obj, options); + + v = await this.#target_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15794,7 +16340,13 @@ instruments?: (Object | URL)[];} \\"result\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#result_fromJsonLd(doc, options); + + v = await this.#result_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15890,7 +16442,13 @@ instruments?: (Object | URL)[];} \\"result\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#result_fromJsonLd(obj, options); + + v = await this.#result_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16109,7 +16667,13 @@ instruments?: (Object | URL)[];} \\"origin\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#origin_fromJsonLd(doc, options); + + v = await this.#origin_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16206,7 +16770,13 @@ instruments?: (Object | URL)[];} \\"origin\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#origin_fromJsonLd(obj, options); + + v = await this.#origin_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16423,7 +16993,13 @@ instruments?: (Object | URL)[];} \\"instrument\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#instrument_fromJsonLd(doc, options); + + v = await this.#instrument_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16518,7 +17094,13 @@ instruments?: (Object | URL)[];} \\"instrument\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#instrument_fromJsonLd(obj, options); + + v = await this.#instrument_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16799,7 +17381,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -16988,23 +17573,43 @@ instruments?: (Object | URL)[];} typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -17039,7 +17644,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(decoded); @@ -17072,7 +17681,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(decoded); @@ -17105,7 +17718,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(decoded); @@ -17138,7 +17755,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(decoded); @@ -17171,7 +17792,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(decoded); @@ -17642,7 +18267,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -17722,6 +18350,7 @@ export class PropertyValue { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -17751,6 +18380,10 @@ export class PropertyValue { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. @@ -17782,6 +18415,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -18145,7 +18780,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -18161,7 +18799,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; @@ -18323,6 +18961,7 @@ export class Measure { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -18352,6 +18991,10 @@ export class Measure { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Measure}: \`http://www.ontology-of-units-of-measure.org/resource/om-2/Measure\`. @@ -18383,6 +19026,8 @@ unit?: string | null;numericalValue?: Decimal | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -18731,7 +19376,10 @@ unit?: string | null;numericalValue?: Decimal | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -18747,7 +19395,7 @@ unit?: string | null;numericalValue?: Decimal | null;} } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _27fgyFbosTtMAhuepJH8K3ZGURT6: (string)[] = []; @@ -19230,7 +19878,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -19445,7 +20099,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -19722,7 +20382,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -19773,7 +20436,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -19806,7 +20473,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -20171,7 +20842,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -20258,6 +20932,7 @@ export class InteractionPolicy { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -20287,6 +20962,10 @@ export class InteractionPolicy { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link InteractionPolicy}: \`https://gotosocial.org/ns#InteractionPolicy\`. @@ -20320,6 +20999,8 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -20762,7 +21443,10 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -20778,7 +21462,7 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; @@ -20796,7 +21480,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.push(decoded); @@ -20817,7 +21505,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.push(decoded); @@ -20838,7 +21530,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.push(decoded); @@ -20859,7 +21555,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.push(decoded); @@ -21034,6 +21734,7 @@ export class InteractionRule { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -21063,6 +21764,10 @@ export class InteractionRule { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link InteractionRule}: \`https://gotosocial.org/ns#InteractionRule\`. @@ -21096,6 +21801,8 @@ manualApprovals?: (URL)[];} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -21510,7 +22217,10 @@ get manualApprovals(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -21526,7 +22236,7 @@ get manualApprovals(): (URL)[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; @@ -21555,9 +22265,17 @@ get manualApprovals(): (URL)[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.push(decoded); } @@ -21588,9 +22306,17 @@ get manualApprovals(): (URL)[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.push(decoded); } @@ -22050,7 +22776,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -22265,7 +22997,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -22542,7 +23280,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -22593,7 +23334,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -22626,7 +23371,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -22990,7 +23739,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -23402,7 +24154,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -23617,7 +24375,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -23894,7 +24658,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -23945,7 +24712,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -23978,7 +24749,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -24342,7 +25117,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -24753,7 +25531,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -24968,7 +25752,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -25245,7 +26035,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -25296,7 +26089,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -25329,7 +26126,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -25693,7 +26494,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -25777,6 +26581,7 @@ export class DidService { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -25806,6 +26611,10 @@ export class DidService { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link DidService}: \`https://www.w3.org/ns/did#Service\`. @@ -25837,6 +26646,8 @@ endpoints?: (URL)[];} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -26138,7 +26949,10 @@ get endpoints(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -26158,7 +26972,7 @@ get endpoints(): (URL)[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint: (URL)[] = []; @@ -26187,9 +27001,17 @@ get endpoints(): (URL)[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.push(decoded); } @@ -26491,7 +27313,10 @@ endpoints?: (URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -26573,6 +27398,7 @@ export class DataIntegrityProof { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -26602,6 +27428,10 @@ export class DataIntegrityProof { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link DataIntegrityProof}: \`https://w3id.org/security#DataIntegrityProof\`. @@ -26638,6 +27468,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -27309,7 +28141,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -27325,7 +28160,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: (\\"eddsa-jcs-2022\\")[] = []; @@ -27373,7 +28208,11 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.push(decoded); @@ -27608,6 +28447,7 @@ export class CryptographicKey { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -27637,6 +28477,10 @@ export class CryptographicKey { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link CryptographicKey}: \`https://w3id.org/security#Key\`. @@ -27670,6 +28514,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -27999,7 +28845,13 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi \\"owner\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#owner_fromJsonLd(doc, options); + + v = await this.#owner_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -28274,7 +29126,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -28290,7 +29145,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); @@ -28322,23 +29177,43 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -28479,6 +29354,7 @@ export class Multikey { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -28508,6 +29384,10 @@ export class Multikey { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Multikey}: \`https://w3id.org/security#Multikey\`. @@ -28541,6 +29421,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -28870,7 +29752,13 @@ controller?: Application | Group | Organization | Person | Service | URL | null; \\"controller\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#controller_fromJsonLd(doc, options); + + v = await this.#controller_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -29152,7 +30040,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -29168,7 +30059,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); @@ -29200,23 +30091,43 @@ controller?: Application | Group | Organization | Person | Service | URL | null; typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -29355,6 +30266,7 @@ export class Intent { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -29384,6 +30296,10 @@ export class Intent { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Intent}: \`https://w3id.org/valueflows/ont/vf#Intent\`. @@ -29418,6 +30334,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -29987,7 +30905,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -30003,7 +30924,7 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action: (string)[] = []; @@ -30050,9 +30971,17 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.push(decoded); } @@ -30072,7 +31001,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.push(decoded); @@ -30093,7 +31026,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.push(decoded); @@ -30114,7 +31051,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.push(decoded); @@ -30859,7 +31800,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -30916,7 +31860,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.push(decoded); @@ -30937,7 +31885,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.push(decoded); @@ -31352,7 +32304,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -31692,7 +32647,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -32027,7 +32985,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -33303,7 +34264,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33396,7 +34363,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33615,7 +34588,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33712,7 +34691,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33968,7 +34953,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34201,7 +35192,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34420,7 +35417,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34642,7 +35645,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34862,7 +35871,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35080,7 +36095,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35298,7 +36319,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35514,7 +36541,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35840,7 +36873,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36094,7 +37133,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36191,7 +37236,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36410,7 +37461,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36507,7 +37564,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -37540,7 +38603,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -37615,7 +38681,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -37648,7 +38718,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -37701,11 +38775,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -37742,11 +38824,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -37781,7 +38871,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -37814,7 +38908,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -37847,7 +38945,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -37880,7 +38982,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -37913,7 +39019,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -37946,7 +39056,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -37967,7 +39081,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -38074,23 +39192,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -38127,23 +39265,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -38178,7 +39336,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -39003,7 +40165,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -39350,7 +40515,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -39782,7 +40950,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -40021,7 +41195,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -40343,7 +41523,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -40394,7 +41577,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -40453,7 +41640,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -40984,7 +42175,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -41413,7 +42607,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -41747,7 +42944,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -42087,7 +43287,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -42842,7 +44045,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"current\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#current_fromJsonLd(doc, options); + + v = await this.#current_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43058,7 +44267,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"first\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#first_fromJsonLd(doc, options); + + v = await this.#first_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43274,7 +44489,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"last\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#last_fromJsonLd(doc, options); + + v = await this.#last_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43500,7 +44721,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"items\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43716,7 +44943,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"likesOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likesOf_fromJsonLd(doc, options); + + v = await this.#likesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43931,7 +45164,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"sharesOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#sharesOf_fromJsonLd(doc, options); + + v = await this.#sharesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44146,7 +45385,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"repliesOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#repliesOf_fromJsonLd(doc, options); + + v = await this.#repliesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44361,7 +45606,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"inboxOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inboxOf_fromJsonLd(doc, options); + + v = await this.#inboxOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44576,7 +45827,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"outboxOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outboxOf_fromJsonLd(doc, options); + + v = await this.#outboxOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44791,7 +46048,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"followersOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followersOf_fromJsonLd(doc, options); + + v = await this.#followersOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45006,7 +46269,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"followingOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followingOf_fromJsonLd(doc, options); + + v = await this.#followingOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45221,7 +46490,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"likedOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likedOf_fromJsonLd(doc, options); + + v = await this.#likedOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45886,7 +47161,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -45967,7 +47245,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3UyUdxnyn6cDn53QKrh4MBiearma_current.push(decoded); @@ -46000,7 +47282,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _J52RqweMe6hhv7RnLJMC8BExTE5_first.push(decoded); @@ -46033,7 +47319,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.push(decoded); @@ -46069,12 +47359,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -46109,7 +47407,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.push(decoded); @@ -46142,7 +47444,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.push(decoded); @@ -46175,7 +47481,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.push(decoded); @@ -46208,7 +47518,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.push(decoded); @@ -46241,7 +47555,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.push(decoded); @@ -46274,7 +47592,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.push(decoded); @@ -46307,7 +47629,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.push(decoded); @@ -46340,7 +47666,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.push(decoded); @@ -47020,7 +48350,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"partOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#partOf_fromJsonLd(doc, options); + + v = await this.#partOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47234,7 +48570,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"next\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#next_fromJsonLd(doc, options); + + v = await this.#next_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47449,7 +48791,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"prev\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#prev_fromJsonLd(doc, options); + + v = await this.#prev_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47761,7 +49109,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -47816,7 +49167,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.push(decoded); @@ -47849,7 +49204,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.push(decoded); @@ -47882,7 +49241,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.push(decoded); @@ -48256,7 +49619,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -48590,7 +49956,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -48922,7 +50291,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -49002,6 +50374,7 @@ export class Endpoints { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -49031,6 +50404,10 @@ export class Endpoints { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Endpoints}: \`https://www.w3.org/ns/activitystreams#Endpoints\`. @@ -49066,6 +50443,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -49716,7 +51095,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -49732,7 +51114,7 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl: (URL)[] = []; @@ -49761,9 +51143,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.push(decoded); } @@ -49794,9 +51184,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.push(decoded); } @@ -49827,9 +51225,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.push(decoded); } @@ -49860,9 +51266,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.push(decoded); } @@ -49893,9 +51307,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.push(decoded); } @@ -49926,9 +51348,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.push(decoded); } @@ -50381,7 +51811,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -50716,7 +52149,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -51052,7 +52488,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -52328,7 +53767,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52421,7 +53866,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52640,7 +54091,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52737,7 +54194,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52993,7 +54456,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53226,7 +54695,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53445,7 +54920,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53667,7 +55148,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53887,7 +55374,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54105,7 +55598,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54323,7 +55822,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54539,7 +56044,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54865,7 +56376,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55119,7 +56636,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55216,7 +56739,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55435,7 +56964,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55532,7 +57067,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -56565,7 +58106,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -56640,7 +58184,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -56673,7 +58221,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -56726,11 +58278,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -56767,11 +58327,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -56806,7 +58374,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -56839,7 +58411,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -56872,7 +58448,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -56905,7 +58485,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -56938,7 +58522,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -56971,7 +58559,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -56992,7 +58584,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -57099,23 +58695,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -57152,23 +58768,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -57203,7 +58839,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -57781,6 +59421,7 @@ export class Link { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -57810,6 +59451,10 @@ export class Link { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Link}: \`https://www.w3.org/ns/activitystreams#Link\`. @@ -57851,6 +59496,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -58540,7 +60187,13 @@ get names(): ((string | LanguageString))[] { \\"preview\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#preview_fromJsonLd(obj, options); + + v = await this.#preview_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -58994,7 +60647,10 @@ get names(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -59018,7 +60674,7 @@ get names(): ((string | LanguageString))[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _pVjLsybKQdmkjuU7MHjiVmNnuj7_href: (URL)[] = []; @@ -59047,9 +60703,17 @@ get names(): ((string | LanguageString))[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _pVjLsybKQdmkjuU7MHjiVmNnuj7_href.push(decoded); } @@ -59198,12 +60862,20 @@ get names(): ((string | LanguageString))[] { && 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -59677,7 +61349,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -60014,7 +61689,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -60349,7 +62027,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -60687,7 +62368,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -61021,7 +62705,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -61355,7 +63042,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -61689,7 +63379,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -62021,7 +63714,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -62319,7 +64015,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -62654,7 +64353,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -63088,7 +64790,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -63327,7 +65035,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -63649,7 +65363,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -63700,7 +65417,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -63759,7 +65480,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -64201,7 +65926,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"orderedItems\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -64445,7 +66176,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -64499,12 +66233,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -64938,7 +66680,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"orderedItems\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -65231,7 +66979,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -65285,12 +67036,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -66610,7 +68369,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -66703,7 +68468,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -66922,7 +68693,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67019,7 +68796,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67275,7 +69058,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67508,7 +69297,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67727,7 +69522,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67949,7 +69750,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68169,7 +69976,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68387,7 +70200,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68605,7 +70424,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68821,7 +70646,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69147,7 +70978,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69401,7 +71238,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69498,7 +71341,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69717,7 +71566,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69814,7 +71669,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -70847,7 +72708,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -70922,7 +72786,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -70955,7 +72823,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -71008,11 +72880,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71049,11 +72929,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71088,7 +72976,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -71121,7 +73013,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -71154,7 +73050,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -71187,7 +73087,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -71220,7 +73124,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -71253,7 +73161,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -71274,7 +73186,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -71381,23 +73297,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71434,23 +73370,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71485,7 +73441,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -72312,7 +74272,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -73588,7 +75551,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73681,7 +75650,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73900,7 +75875,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73997,7 +75978,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74253,7 +76240,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74486,7 +76479,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74705,7 +76704,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74927,7 +76932,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75147,7 +77158,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75365,7 +77382,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75583,7 +77606,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75799,7 +77828,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76125,7 +78160,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76379,7 +78420,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76476,7 +78523,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76695,7 +78748,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76792,7 +78851,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -77825,7 +79890,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -77900,7 +79968,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -77933,7 +80005,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -77986,11 +80062,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78027,11 +80111,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78066,7 +80158,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -78099,7 +80195,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -78132,7 +80232,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -78165,7 +80269,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -78198,7 +80306,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -78231,7 +80343,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -78252,7 +80368,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -78359,23 +80479,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78412,23 +80552,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78463,7 +80623,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -79746,7 +81910,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -79890,9 +82057,17 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))) : undefined + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))) : undefined ; if (typeof decoded === \\"undefined\\") continue; _oKrwxU4V8wiKhMW1QEYQibcJh8c_units.push(decoded); @@ -80375,7 +82550,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"describes\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#describes_fromJsonLd(doc, options); + + v = await this.#describes_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -80617,7 +82798,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -80668,7 +82852,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.push(decoded); @@ -81261,7 +83449,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"oneOf\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#exclusiveOption_fromJsonLd(obj, options); + + v = await this.#exclusiveOption_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81480,7 +83674,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"anyOf\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#inclusiveOption_fromJsonLd(obj, options); + + v = await this.#inclusiveOption_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81728,7 +83928,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81967,7 +84173,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -82272,7 +84484,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -82323,7 +84538,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.push(decoded); @@ -82356,7 +84575,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.push(decoded); @@ -82438,7 +84661,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -82497,7 +84724,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -82956,7 +85187,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -83290,7 +85524,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -83850,7 +86087,13 @@ relationships?: (Object | URL)[];} \\"subject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#subject_fromJsonLd(doc, options); + + v = await this.#subject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84065,7 +86308,13 @@ relationships?: (Object | URL)[];} \\"object\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#object_fromJsonLd(doc, options); + + v = await this.#object_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84159,7 +86408,13 @@ relationships?: (Object | URL)[];} \\"object\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#object_fromJsonLd(obj, options); + + v = await this.#object_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84377,7 +86632,13 @@ relationships?: (Object | URL)[];} \\"relationship\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#relationship_fromJsonLd(doc, options); + + v = await this.#relationship_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84473,7 +86734,13 @@ relationships?: (Object | URL)[];} \\"relationship\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#relationship_fromJsonLd(obj, options); + + v = await this.#relationship_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84786,7 +87053,10 @@ relationships?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -84837,7 +87107,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.push(decoded); @@ -84870,7 +87144,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(decoded); @@ -84903,7 +87181,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.push(decoded); @@ -85291,7 +87573,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -86567,7 +88852,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86660,7 +88951,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86879,7 +89176,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86976,7 +89279,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87232,7 +89541,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87465,7 +89780,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87684,7 +90005,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87906,7 +90233,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88126,7 +90459,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88344,7 +90683,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88562,7 +90907,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88778,7 +91129,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89104,7 +91461,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89358,7 +91721,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89455,7 +91824,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89674,7 +92049,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89771,7 +92152,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -90804,7 +93191,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -90879,7 +93269,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -90912,7 +93306,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -90965,11 +93363,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91006,11 +93412,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91045,7 +93459,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -91078,7 +93496,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -91111,7 +93533,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -91144,7 +93570,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -91177,7 +93607,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -91210,7 +93644,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -91231,7 +93669,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -91338,23 +93780,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91391,23 +93853,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91442,7 +93924,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -92012,6 +94498,7 @@ export class Source { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -92041,6 +94528,10 @@ export class Source { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Source}: \`https://www.w3.org/ns/activitystreams#Source\`. @@ -92073,6 +94564,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"\$warning\\" in options) { this.#warning = options.\$warning as unknown as { category: string[]; @@ -92478,7 +94971,10 @@ get contents(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -92494,7 +94990,7 @@ get contents(): ((string | LanguageString))[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; @@ -92910,7 +95406,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -93244,7 +95743,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -93794,7 +96296,10 @@ get formerTypes(): (\$EntityType)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -94229,7 +96734,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -94568,7 +97076,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -94905,7 +97416,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -95242,7 +97756,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -95575,7 +98092,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap index 0dc4db976..c4601ae8a 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap @@ -1,5 +1,5 @@ exports[`generateClasses() 1`] = ` -"// deno-lint-ignore-file ban-unused-ignore no-unused-vars prefer-const verbatim-module-syntax +"// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax import jsonld from \\"@fedify/vocab-runtime/jsonld\\"; import { getLogger } from \\"@logtape/logtape\\"; import { type Span, SpanStatusCode, type TracerProvider, trace } @@ -26,6 +26,8 @@ import { } from \\"@fedify/vocab-runtime/temporal\\"; +import * as _ppM0 from \\"./preprocessors.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}, @@ -44,6 +46,7 @@ export class Object { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -73,6 +76,10 @@ export class Object { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Object}: \`https://www.w3.org/ns/activitystreams#Object\`. @@ -201,6 +208,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -2332,7 +2341,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"attachment\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attachment_fromJsonLd(obj, options); + + v = await this.#attachment_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2586,7 +2601,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"attributedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#attribution_fromJsonLd(doc, options); + + v = await this.#attribution_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2682,7 +2703,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"attributedTo\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#attribution_fromJsonLd(obj, options); + + v = await this.#attribution_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2899,7 +2926,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"audience\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#audience_fromJsonLd(doc, options); + + v = await this.#audience_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2994,7 +3027,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"audience\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#audience_fromJsonLd(obj, options); + + v = await this.#audience_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3255,7 +3294,13 @@ get contents(): ((string | LanguageString))[] { \\"context\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#context_fromJsonLd(obj, options); + + v = await this.#context_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3523,7 +3568,13 @@ get names(): ((string | LanguageString))[] { \\"generator\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#generator_fromJsonLd(obj, options); + + v = await this.#generator_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3661,6 +3712,27 @@ get names(): ((string | LanguageString))[] { this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; + if (jsonLd != null && typeof jsonLd === \\"object\\") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + + { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as Image; + } + + } + } + try { return await Image.fromJsonLd( jsonLd, @@ -3741,7 +3813,13 @@ get names(): ((string | LanguageString))[] { \\"icon\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#icon_fromJsonLd(doc, options); + + v = await this.#icon_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3837,7 +3915,13 @@ get names(): ((string | LanguageString))[] { \\"icon\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#icon_fromJsonLd(obj, options); + + v = await this.#icon_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3975,6 +4059,27 @@ get names(): ((string | LanguageString))[] { this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; + if (jsonLd != null && typeof jsonLd === \\"object\\") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + + { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as Image; + } + + } + } + try { return await Image.fromJsonLd( jsonLd, @@ -4055,7 +4160,13 @@ get names(): ((string | LanguageString))[] { \\"image\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#image_fromJsonLd(doc, options); + + v = await this.#image_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4151,7 +4262,13 @@ get names(): ((string | LanguageString))[] { \\"image\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#image_fromJsonLd(obj, options); + + v = await this.#image_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4377,7 +4494,13 @@ get names(): ((string | LanguageString))[] { \\"inReplyTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#replyTarget_fromJsonLd(doc, options); + + v = await this.#replyTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4472,7 +4595,13 @@ get names(): ((string | LanguageString))[] { \\"inReplyTo\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#replyTarget_fromJsonLd(obj, options); + + v = await this.#replyTarget_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4698,7 +4827,13 @@ get names(): ((string | LanguageString))[] { \\"location\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#location_fromJsonLd(doc, options); + + v = await this.#location_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4793,7 +4928,13 @@ get names(): ((string | LanguageString))[] { \\"location\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#location_fromJsonLd(obj, options); + + v = await this.#location_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5018,7 +5159,13 @@ get names(): ((string | LanguageString))[] { \\"preview\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#preview_fromJsonLd(doc, options); + + v = await this.#preview_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5112,7 +5259,13 @@ get names(): ((string | LanguageString))[] { \\"preview\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#preview_fromJsonLd(obj, options); + + v = await this.#preview_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5342,7 +5495,13 @@ get names(): ((string | LanguageString))[] { \\"replies\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#replies_fromJsonLd(doc, options); + + v = await this.#replies_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5564,7 +5723,13 @@ get names(): ((string | LanguageString))[] { \\"shares\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#shares_fromJsonLd(doc, options); + + v = await this.#shares_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5786,7 +5951,13 @@ get names(): ((string | LanguageString))[] { \\"likes\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likes_fromJsonLd(doc, options); + + v = await this.#likes_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6002,7 +6173,13 @@ get names(): ((string | LanguageString))[] { \\"emojiReactions\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#emojiReactions_fromJsonLd(doc, options); + + v = await this.#emojiReactions_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6270,7 +6447,13 @@ get summaries(): ((string | LanguageString))[] { \\"tag\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#tag_fromJsonLd(obj, options); + + v = await this.#tag_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6521,7 +6704,13 @@ get urls(): ((URL | Link))[] { \\"to\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#to_fromJsonLd(doc, options); + + v = await this.#to_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6616,7 +6805,13 @@ get urls(): ((URL | Link))[] { \\"to\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#to_fromJsonLd(obj, options); + + v = await this.#to_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6833,7 +7028,13 @@ get urls(): ((URL | Link))[] { \\"bto\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#bto_fromJsonLd(doc, options); + + v = await this.#bto_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6928,7 +7129,13 @@ get urls(): ((URL | Link))[] { \\"bto\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#bto_fromJsonLd(obj, options); + + v = await this.#bto_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7145,7 +7352,13 @@ get urls(): ((URL | Link))[] { \\"cc\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#cc_fromJsonLd(doc, options); + + v = await this.#cc_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7240,7 +7453,13 @@ get urls(): ((URL | Link))[] { \\"cc\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#cc_fromJsonLd(obj, options); + + v = await this.#cc_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7457,7 +7676,13 @@ get urls(): ((URL | Link))[] { \\"bcc\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#bcc_fromJsonLd(doc, options); + + v = await this.#bcc_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7552,7 +7777,13 @@ get urls(): ((URL | Link))[] { \\"bcc\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#bcc_fromJsonLd(obj, options); + + v = await this.#bcc_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7832,7 +8063,13 @@ get urls(): ((URL | Link))[] { \\"proof\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#proof_fromJsonLd(doc, options); + + v = await this.#proof_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7926,7 +8163,13 @@ get urls(): ((URL | Link))[] { \\"proof\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#proof_fromJsonLd(obj, options); + + v = await this.#proof_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8182,7 +8425,13 @@ get urls(): ((URL | Link))[] { \\"likeAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likeAuthorization_fromJsonLd(doc, options); + + v = await this.#likeAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8398,7 +8647,13 @@ get urls(): ((URL | Link))[] { \\"replyAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#replyAuthorization_fromJsonLd(doc, options); + + v = await this.#replyAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8614,7 +8869,13 @@ get urls(): ((URL | Link))[] { \\"announceAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#announceAuthorization_fromJsonLd(doc, options); + + v = await this.#announceAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -10162,7 +10423,10 @@ get urls(): ((URL | Link))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -10430,7 +10694,7 @@ get urls(): ((URL | Link))[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); @@ -10463,16 +10727,28 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\") ? await PropertyValue.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10509,23 +10785,43 @@ get urls(): ((URL | Link))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10560,7 +10856,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.push(decoded); @@ -10620,12 +10920,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10709,12 +11017,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10737,6 +11053,32 @@ get urls(): ((URL | Link))[] { ) { if (v == null) continue; + { + let _handled: Image | undefined; + + if (_handled === undefined) { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)), + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as Image; + } + } + + if (_handled !== undefined) { + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(_handled); + continue; + } + } + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push( @@ -10749,7 +11091,11 @@ get urls(): ((URL | Link))[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(decoded); @@ -10770,6 +11116,32 @@ get urls(): ((URL | Link))[] { ) { if (v == null) continue; + { + let _handled: Image | undefined; + + if (_handled === undefined) { + const _result = await _ppM0[\\"normalizeLinkToImage\\"](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)), + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as Image; + } + } + + if (_handled !== undefined) { + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(_handled); + continue; + } + } + if (typeof v === \\"object\\" && \\"@id\\" in v && !(\\"@type\\" in v) && globalThis.Object.keys(v).length === 1) { _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push( @@ -10782,7 +11154,11 @@ get urls(): ((URL | Link))[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(decoded); @@ -10818,12 +11194,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10861,12 +11245,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10904,12 +11296,20 @@ get urls(): ((URL | Link))[] { && 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -10966,7 +11366,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _7UpwM3JWcXhADcscukEehBorf6k_replies.push(decoded); @@ -10999,7 +11403,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3kAfck9PcEYt2L7xug5y99YPbANs_shares.push(decoded); @@ -11032,7 +11440,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.push(decoded); @@ -11065,7 +11477,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.push(decoded); @@ -11147,12 +11563,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -11211,13 +11635,25 @@ get urls(): ((URL | Link))[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))) : typeof v === \\"object\\" && \\"@type\\" in v + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -11252,7 +11688,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.push(decoded); @@ -11285,7 +11725,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.push(decoded); @@ -11318,7 +11762,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.push(decoded); @@ -11351,7 +11799,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.push(decoded); @@ -11426,7 +11878,11 @@ get urls(): ((URL | Link))[] { const decoded = await Source.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.push(decoded); @@ -11459,7 +11915,11 @@ get urls(): ((URL | Link))[] { const decoded = await DataIntegrityProof.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.push(decoded); @@ -11480,7 +11940,11 @@ get urls(): ((URL | Link))[] { const decoded = await InteractionPolicy.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.push(decoded); @@ -11512,9 +11976,17 @@ get urls(): ((URL | Link))[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.push(decoded); } @@ -11546,7 +12018,11 @@ get urls(): ((URL | Link))[] { const decoded = await LikeAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push(decoded); @@ -11579,7 +12055,11 @@ get urls(): ((URL | Link))[] { const decoded = await ReplyAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push(decoded); @@ -11612,7 +12092,11 @@ get urls(): ((URL | Link))[] { const decoded = await AnnounceAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(decoded); @@ -12790,7 +13274,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -13227,7 +13714,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -13466,7 +13959,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -13788,7 +14287,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -13839,7 +14341,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -13898,7 +14404,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -14844,7 +15354,13 @@ instruments?: (Object | URL)[];} \\"actor\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#actor_fromJsonLd(doc, options); + + v = await this.#actor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -14940,7 +15456,13 @@ instruments?: (Object | URL)[];} \\"actor\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#actor_fromJsonLd(obj, options); + + v = await this.#actor_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15158,7 +15680,13 @@ instruments?: (Object | URL)[];} \\"object\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#object_fromJsonLd(doc, options); + + v = await this.#object_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15254,7 +15782,13 @@ instruments?: (Object | URL)[];} \\"object\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#object_fromJsonLd(obj, options); + + v = await this.#object_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15475,7 +16009,13 @@ instruments?: (Object | URL)[];} \\"target\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#target_fromJsonLd(doc, options); + + v = await this.#target_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15574,7 +16114,13 @@ instruments?: (Object | URL)[];} \\"target\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#target_fromJsonLd(obj, options); + + v = await this.#target_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15792,7 +16338,13 @@ instruments?: (Object | URL)[];} \\"result\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#result_fromJsonLd(doc, options); + + v = await this.#result_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15888,7 +16440,13 @@ instruments?: (Object | URL)[];} \\"result\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#result_fromJsonLd(obj, options); + + v = await this.#result_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16107,7 +16665,13 @@ instruments?: (Object | URL)[];} \\"origin\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#origin_fromJsonLd(doc, options); + + v = await this.#origin_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16204,7 +16768,13 @@ instruments?: (Object | URL)[];} \\"origin\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#origin_fromJsonLd(obj, options); + + v = await this.#origin_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16421,7 +16991,13 @@ instruments?: (Object | URL)[];} \\"instrument\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#instrument_fromJsonLd(doc, options); + + v = await this.#instrument_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16516,7 +17092,13 @@ instruments?: (Object | URL)[];} \\"instrument\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#instrument_fromJsonLd(obj, options); + + v = await this.#instrument_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16797,7 +17379,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -16986,23 +17571,43 @@ instruments?: (Object | URL)[];} typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -17037,7 +17642,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(decoded); @@ -17070,7 +17679,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(decoded); @@ -17103,7 +17716,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(decoded); @@ -17136,7 +17753,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(decoded); @@ -17169,7 +17790,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(decoded); @@ -17640,7 +18265,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -17720,6 +18348,7 @@ export class PropertyValue { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -17749,6 +18378,10 @@ export class PropertyValue { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. @@ -17780,6 +18413,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -18143,7 +18778,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -18159,7 +18797,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; @@ -18321,6 +18959,7 @@ export class Measure { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -18350,6 +18989,10 @@ export class Measure { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Measure}: \`http://www.ontology-of-units-of-measure.org/resource/om-2/Measure\`. @@ -18381,6 +19024,8 @@ unit?: string | null;numericalValue?: Decimal | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -18729,7 +19374,10 @@ unit?: string | null;numericalValue?: Decimal | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -18745,7 +19393,7 @@ unit?: string | null;numericalValue?: Decimal | null;} } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _27fgyFbosTtMAhuepJH8K3ZGURT6: (string)[] = []; @@ -19228,7 +19876,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -19443,7 +20097,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -19720,7 +20380,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -19771,7 +20434,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -19804,7 +20471,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -20169,7 +20840,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -20256,6 +20930,7 @@ export class InteractionPolicy { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -20285,6 +20960,10 @@ export class InteractionPolicy { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link InteractionPolicy}: \`https://gotosocial.org/ns#InteractionPolicy\`. @@ -20318,6 +20997,8 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -20760,7 +21441,10 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -20776,7 +21460,7 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; @@ -20794,7 +21478,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.push(decoded); @@ -20815,7 +21503,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.push(decoded); @@ -20836,7 +21528,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.push(decoded); @@ -20857,7 +21553,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.push(decoded); @@ -21032,6 +21732,7 @@ export class InteractionRule { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -21061,6 +21762,10 @@ export class InteractionRule { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link InteractionRule}: \`https://gotosocial.org/ns#InteractionRule\`. @@ -21094,6 +21799,8 @@ manualApprovals?: (URL)[];} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -21508,7 +22215,10 @@ get manualApprovals(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -21524,7 +22234,7 @@ get manualApprovals(): (URL)[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; @@ -21553,9 +22263,17 @@ get manualApprovals(): (URL)[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.push(decoded); } @@ -21586,9 +22304,17 @@ get manualApprovals(): (URL)[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.push(decoded); } @@ -22048,7 +22774,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -22263,7 +22995,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -22540,7 +23278,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -22591,7 +23332,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -22624,7 +23369,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -22988,7 +23737,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -23400,7 +24152,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -23615,7 +24373,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -23892,7 +24656,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -23943,7 +24710,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -23976,7 +24747,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -24340,7 +25115,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -24751,7 +25529,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactingObject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -24966,7 +25750,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"interactionTarget\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -25243,7 +26033,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -25294,7 +26087,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -25327,7 +26124,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -25691,7 +26492,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -25775,6 +26579,7 @@ export class DidService { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -25804,6 +26609,10 @@ export class DidService { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link DidService}: \`https://www.w3.org/ns/did#Service\`. @@ -25835,6 +26644,8 @@ endpoints?: (URL)[];} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -26136,7 +26947,10 @@ get endpoints(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -26156,7 +26970,7 @@ get endpoints(): (URL)[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint: (URL)[] = []; @@ -26185,9 +26999,17 @@ get endpoints(): (URL)[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.push(decoded); } @@ -26489,7 +27311,10 @@ endpoints?: (URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -26571,6 +27396,7 @@ export class DataIntegrityProof { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -26600,6 +27426,10 @@ export class DataIntegrityProof { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link DataIntegrityProof}: \`https://w3id.org/security#DataIntegrityProof\`. @@ -26636,6 +27466,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -27307,7 +28139,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -27323,7 +28158,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: (\\"eddsa-jcs-2022\\")[] = []; @@ -27371,7 +28206,11 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.push(decoded); @@ -27606,6 +28445,7 @@ export class CryptographicKey { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -27635,6 +28475,10 @@ export class CryptographicKey { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link CryptographicKey}: \`https://w3id.org/security#Key\`. @@ -27668,6 +28512,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -27997,7 +28843,13 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi \\"owner\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#owner_fromJsonLd(doc, options); + + v = await this.#owner_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -28272,7 +29124,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -28288,7 +29143,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); @@ -28320,23 +29175,43 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -28477,6 +29352,7 @@ export class Multikey { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -28506,6 +29382,10 @@ export class Multikey { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Multikey}: \`https://w3id.org/security#Multikey\`. @@ -28539,6 +29419,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -28868,7 +29750,13 @@ controller?: Application | Group | Organization | Person | Service | URL | null; \\"controller\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#controller_fromJsonLd(doc, options); + + v = await this.#controller_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -29150,7 +30038,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -29166,7 +30057,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); @@ -29198,23 +30089,43 @@ controller?: Application | Group | Organization | Person | Service | URL | null; typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -29353,6 +30264,7 @@ export class Intent { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -29382,6 +30294,10 @@ export class Intent { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Intent}: \`https://w3id.org/valueflows/ont/vf#Intent\`. @@ -29416,6 +30332,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -29985,7 +30903,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -30001,7 +30922,7 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action: (string)[] = []; @@ -30048,9 +30969,17 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.push(decoded); } @@ -30070,7 +30999,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.push(decoded); @@ -30091,7 +31024,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.push(decoded); @@ -30112,7 +31049,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.push(decoded); @@ -30857,7 +31798,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -30914,7 +31858,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.push(decoded); @@ -30935,7 +31883,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.push(decoded); @@ -31350,7 +32302,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -31690,7 +32645,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -32025,7 +32983,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -33301,7 +34262,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33394,7 +34361,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33613,7 +34586,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33710,7 +34689,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33966,7 +34951,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34199,7 +35190,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34418,7 +35415,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34640,7 +35643,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34860,7 +35869,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35078,7 +36093,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35296,7 +36317,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35512,7 +36539,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35838,7 +36871,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36092,7 +37131,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36189,7 +37234,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36408,7 +37459,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36505,7 +37562,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -37538,7 +38601,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -37613,7 +38679,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -37646,7 +38716,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -37699,11 +38773,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -37740,11 +38822,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -37779,7 +38869,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -37812,7 +38906,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -37845,7 +38943,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -37878,7 +38980,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -37911,7 +39017,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -37944,7 +39054,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -37965,7 +39079,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -38072,23 +39190,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -38125,23 +39263,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -38176,7 +39334,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -39001,7 +40163,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -39348,7 +40513,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -39780,7 +40948,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -40019,7 +41193,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -40341,7 +41521,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -40392,7 +41575,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -40451,7 +41638,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -40982,7 +42173,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -41411,7 +42605,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -41745,7 +42942,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -42085,7 +43285,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -42840,7 +44043,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"current\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#current_fromJsonLd(doc, options); + + v = await this.#current_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43056,7 +44265,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"first\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#first_fromJsonLd(doc, options); + + v = await this.#first_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43272,7 +44487,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"last\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#last_fromJsonLd(doc, options); + + v = await this.#last_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43498,7 +44719,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"items\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43714,7 +44941,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"likesOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likesOf_fromJsonLd(doc, options); + + v = await this.#likesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43929,7 +45162,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"sharesOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#sharesOf_fromJsonLd(doc, options); + + v = await this.#sharesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44144,7 +45383,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"repliesOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#repliesOf_fromJsonLd(doc, options); + + v = await this.#repliesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44359,7 +45604,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"inboxOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inboxOf_fromJsonLd(doc, options); + + v = await this.#inboxOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44574,7 +45825,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"outboxOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outboxOf_fromJsonLd(doc, options); + + v = await this.#outboxOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44789,7 +46046,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"followersOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followersOf_fromJsonLd(doc, options); + + v = await this.#followersOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45004,7 +46267,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"followingOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followingOf_fromJsonLd(doc, options); + + v = await this.#followingOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45219,7 +46488,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"likedOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#likedOf_fromJsonLd(doc, options); + + v = await this.#likedOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45884,7 +47159,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -45965,7 +47243,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3UyUdxnyn6cDn53QKrh4MBiearma_current.push(decoded); @@ -45998,7 +47280,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _J52RqweMe6hhv7RnLJMC8BExTE5_first.push(decoded); @@ -46031,7 +47317,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.push(decoded); @@ -46067,12 +47357,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -46107,7 +47405,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.push(decoded); @@ -46140,7 +47442,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.push(decoded); @@ -46173,7 +47479,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.push(decoded); @@ -46206,7 +47516,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.push(decoded); @@ -46239,7 +47553,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.push(decoded); @@ -46272,7 +47590,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.push(decoded); @@ -46305,7 +47627,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.push(decoded); @@ -46338,7 +47664,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.push(decoded); @@ -47018,7 +48348,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"partOf\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#partOf_fromJsonLd(doc, options); + + v = await this.#partOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47232,7 +48568,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"next\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#next_fromJsonLd(doc, options); + + v = await this.#next_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47447,7 +48789,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"prev\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#prev_fromJsonLd(doc, options); + + v = await this.#prev_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47759,7 +49107,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -47814,7 +49165,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.push(decoded); @@ -47847,7 +49202,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.push(decoded); @@ -47880,7 +49239,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.push(decoded); @@ -48254,7 +49617,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -48588,7 +49954,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -48920,7 +50289,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -49000,6 +50372,7 @@ export class Endpoints { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -49029,6 +50402,10 @@ export class Endpoints { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Endpoints}: \`https://www.w3.org/ns/activitystreams#Endpoints\`. @@ -49064,6 +50441,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -49714,7 +51093,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -49730,7 +51112,7 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl: (URL)[] = []; @@ -49759,9 +51141,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.push(decoded); } @@ -49792,9 +51182,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.push(decoded); } @@ -49825,9 +51223,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.push(decoded); } @@ -49858,9 +51264,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.push(decoded); } @@ -49891,9 +51305,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.push(decoded); } @@ -49924,9 +51346,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.push(decoded); } @@ -50379,7 +51809,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -50714,7 +52147,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -51050,7 +52486,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -52326,7 +53765,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52419,7 +53864,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52638,7 +54089,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52735,7 +54192,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52991,7 +54454,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53224,7 +54693,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53443,7 +54918,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53665,7 +55146,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53885,7 +55372,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54103,7 +55596,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54321,7 +55820,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54537,7 +56042,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54863,7 +56374,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55117,7 +56634,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55214,7 +56737,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55433,7 +56962,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55530,7 +57065,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -56563,7 +58104,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -56638,7 +58182,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -56671,7 +58219,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -56724,11 +58276,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -56765,11 +58325,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -56804,7 +58372,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -56837,7 +58409,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -56870,7 +58446,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -56903,7 +58483,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -56936,7 +58520,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -56969,7 +58557,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -56990,7 +58582,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -57097,23 +58693,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -57150,23 +58766,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -57201,7 +58837,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -57779,6 +59419,7 @@ export class Link { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -57808,6 +59449,10 @@ export class Link { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Link}: \`https://www.w3.org/ns/activitystreams#Link\`. @@ -57849,6 +59494,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -58538,7 +60185,13 @@ get names(): ((string | LanguageString))[] { \\"preview\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#preview_fromJsonLd(obj, options); + + v = await this.#preview_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -58992,7 +60645,10 @@ get names(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -59016,7 +60672,7 @@ get names(): ((string | LanguageString))[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _pVjLsybKQdmkjuU7MHjiVmNnuj7_href: (URL)[] = []; @@ -59045,9 +60701,17 @@ get names(): ((string | LanguageString))[] { : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))); + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))); if (typeof decoded === \\"undefined\\") continue; _pVjLsybKQdmkjuU7MHjiVmNnuj7_href.push(decoded); } @@ -59196,12 +60860,20 @@ get names(): ((string | LanguageString))[] { && 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -59675,7 +61347,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -60012,7 +61687,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -60347,7 +62025,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -60685,7 +62366,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -61019,7 +62703,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -61353,7 +63040,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -61687,7 +63377,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -62019,7 +63712,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -62317,7 +64013,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -62652,7 +64351,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -63086,7 +64788,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -63325,7 +65033,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -63647,7 +65361,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -63698,7 +65415,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -63757,7 +65478,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -64199,7 +65924,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"orderedItems\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -64443,7 +66174,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -64497,12 +66231,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -64936,7 +66678,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"orderedItems\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -65229,7 +66977,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -65283,12 +67034,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#Object\\",\\"http://joinmastodon.org/ns#Emoji\\",\\"http://litepub.social/ns#ChatMessage\\",\\"https://gotosocial.org/ns#AnnounceAuthorization\\",\\"https://gotosocial.org/ns#LikeApproval\\",\\"https://gotosocial.org/ns#ReplyAuthorization\\",\\"https://w3id.org/fep/044f#QuoteAuthorization\\",\\"https://w3id.org/valueflows/ont/vf#Proposal\\",\\"https://www.w3.org/ns/activitystreams#Activity\\",\\"http://litepub.social/ns#EmojiReact\\",\\"https://gotosocial.org/ns#AnnounceRequest\\",\\"https://gotosocial.org/ns#LikeRequest\\",\\"https://gotosocial.org/ns#ReplyRequest\\",\\"https://w3id.org/fep/044f#QuoteRequest\\",\\"https://www.w3.org/ns/activitystreams#Accept\\",\\"https://www.w3.org/ns/activitystreams#TentativeAccept\\",\\"https://www.w3.org/ns/activitystreams#Add\\",\\"https://www.w3.org/ns/activitystreams#Announce\\",\\"https://www.w3.org/ns/activitystreams#Create\\",\\"https://www.w3.org/ns/activitystreams#Delete\\",\\"https://www.w3.org/ns/activitystreams#Dislike\\",\\"https://www.w3.org/ns/activitystreams#Flag\\",\\"https://www.w3.org/ns/activitystreams#Follow\\",\\"https://www.w3.org/ns/activitystreams#Ignore\\",\\"https://www.w3.org/ns/activitystreams#Block\\",\\"https://www.w3.org/ns/activitystreams#IntransitiveActivity\\",\\"https://www.w3.org/ns/activitystreams#Arrive\\",\\"https://www.w3.org/ns/activitystreams#Question\\",\\"https://www.w3.org/ns/activitystreams#Travel\\",\\"https://www.w3.org/ns/activitystreams#Join\\",\\"https://www.w3.org/ns/activitystreams#Leave\\",\\"https://www.w3.org/ns/activitystreams#Like\\",\\"https://www.w3.org/ns/activitystreams#Listen\\",\\"https://www.w3.org/ns/activitystreams#Move\\",\\"https://www.w3.org/ns/activitystreams#Offer\\",\\"https://www.w3.org/ns/activitystreams#Invite\\",\\"https://www.w3.org/ns/activitystreams#Read\\",\\"https://www.w3.org/ns/activitystreams#Reject\\",\\"https://www.w3.org/ns/activitystreams#TentativeReject\\",\\"https://www.w3.org/ns/activitystreams#Remove\\",\\"https://www.w3.org/ns/activitystreams#Undo\\",\\"https://www.w3.org/ns/activitystreams#Update\\",\\"https://www.w3.org/ns/activitystreams#View\\",\\"https://www.w3.org/ns/activitystreams#Application\\",\\"https://www.w3.org/ns/activitystreams#Article\\",\\"https://www.w3.org/ns/activitystreams#Collection\\",\\"https://www.w3.org/ns/activitystreams#CollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollectionPage\\",\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://www.w3.org/ns/activitystreams#Document\\",\\"https://www.w3.org/ns/activitystreams#Audio\\",\\"https://www.w3.org/ns/activitystreams#Image\\",\\"https://www.w3.org/ns/activitystreams#Page\\",\\"https://www.w3.org/ns/activitystreams#Video\\",\\"https://www.w3.org/ns/activitystreams#Event\\",\\"https://www.w3.org/ns/activitystreams#Group\\",\\"https://www.w3.org/ns/activitystreams#Note\\",\\"https://www.w3.org/ns/activitystreams#Organization\\",\\"https://www.w3.org/ns/activitystreams#Person\\",\\"https://www.w3.org/ns/activitystreams#Place\\",\\"https://www.w3.org/ns/activitystreams#Profile\\",\\"https://www.w3.org/ns/activitystreams#Relationship\\",\\"https://www.w3.org/ns/activitystreams#Service\\",\\"https://www.w3.org/ns/activitystreams#Tombstone\\"].some( t => v[\\"@type\\"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -66608,7 +68367,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -66701,7 +68466,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -66920,7 +68691,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67017,7 +68794,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67273,7 +69056,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67506,7 +69295,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67725,7 +69520,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67947,7 +69748,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68167,7 +69974,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68385,7 +70198,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68603,7 +70422,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68819,7 +70644,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69145,7 +70976,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69399,7 +71236,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69496,7 +71339,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69715,7 +71564,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69812,7 +71667,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -70845,7 +72706,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -70920,7 +72784,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -70953,7 +72821,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -71006,11 +72878,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71047,11 +72927,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71086,7 +72974,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -71119,7 +73011,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -71152,7 +73048,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -71185,7 +73085,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -71218,7 +73122,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -71251,7 +73159,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -71272,7 +73184,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -71379,23 +73295,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71432,23 +73368,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -71483,7 +73439,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -72310,7 +74270,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -73586,7 +75549,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73679,7 +75648,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73898,7 +75873,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73995,7 +75976,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74251,7 +76238,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74484,7 +76477,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74703,7 +76702,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74925,7 +76930,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75145,7 +77156,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75363,7 +77380,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75581,7 +77604,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75797,7 +77826,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76123,7 +78158,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76377,7 +78418,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76474,7 +78521,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76693,7 +78746,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76790,7 +78849,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -77823,7 +79888,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -77898,7 +79966,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -77931,7 +80003,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -77984,11 +80060,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78025,11 +80109,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78064,7 +80156,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -78097,7 +80193,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -78130,7 +80230,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -78163,7 +80267,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -78196,7 +80304,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -78229,7 +80341,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -78250,7 +80366,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -78357,23 +80477,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78410,23 +80550,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -78461,7 +80621,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -79744,7 +81908,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -79888,9 +82055,17 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu : \\"\\" ) ) - : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) + : URL.canParse(v[\\"@id\\"]) && (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) ? new URL(v[\\"@id\\"]) - : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"]))) : undefined + : new URL(v[\\"@id\\"], (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl))) : undefined ; if (typeof decoded === \\"undefined\\") continue; _oKrwxU4V8wiKhMW1QEYQibcJh8c_units.push(decoded); @@ -80373,7 +82548,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu \\"describes\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#describes_fromJsonLd(doc, options); + + v = await this.#describes_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -80615,7 +82796,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -80666,7 +82850,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.push(decoded); @@ -81259,7 +83447,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"oneOf\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#exclusiveOption_fromJsonLd(obj, options); + + v = await this.#exclusiveOption_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81478,7 +83672,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"anyOf\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#inclusiveOption_fromJsonLd(obj, options); + + v = await this.#inclusiveOption_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81726,7 +83926,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"quote\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81965,7 +84171,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti \\"quoteAuthorization\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -82270,7 +84482,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -82321,7 +84536,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.push(decoded); @@ -82354,7 +84573,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.push(decoded); @@ -82436,7 +84659,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -82495,7 +84722,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -82954,7 +85185,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -83288,7 +85522,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -83848,7 +86085,13 @@ relationships?: (Object | URL)[];} \\"subject\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#subject_fromJsonLd(doc, options); + + v = await this.#subject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84063,7 +86306,13 @@ relationships?: (Object | URL)[];} \\"object\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#object_fromJsonLd(doc, options); + + v = await this.#object_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84157,7 +86406,13 @@ relationships?: (Object | URL)[];} \\"object\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#object_fromJsonLd(obj, options); + + v = await this.#object_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84375,7 +86630,13 @@ relationships?: (Object | URL)[];} \\"relationship\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#relationship_fromJsonLd(doc, options); + + v = await this.#relationship_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84471,7 +86732,13 @@ relationships?: (Object | URL)[];} \\"relationship\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#relationship_fromJsonLd(obj, options); + + v = await this.#relationship_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84784,7 +87051,10 @@ relationships?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -84835,7 +87105,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.push(decoded); @@ -84868,7 +87142,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(decoded); @@ -84901,7 +87179,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.push(decoded); @@ -85289,7 +87571,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -86565,7 +88850,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86658,7 +88949,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"publicKey\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86877,7 +89174,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86974,7 +89277,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"assertionMethod\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87230,7 +89539,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"inbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87463,7 +89778,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"outbox\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87682,7 +90003,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"following\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87904,7 +90231,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"followers\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88124,7 +90457,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"liked\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88342,7 +90681,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featured\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88560,7 +90905,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"featuredTags\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88776,7 +91127,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"streams\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89102,7 +91459,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"movedTo\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89356,7 +91719,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89453,7 +91822,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"alsoKnownAs\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89672,7 +92047,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89769,7 +92150,13 @@ get preferredUsernames(): ((string | LanguageString))[] { \\"service\\"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -90802,7 +93189,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -90877,7 +93267,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -90910,7 +93304,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -90963,11 +93361,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91004,11 +93410,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : 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, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91043,7 +93457,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -91076,7 +93494,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -91109,7 +93531,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -91142,7 +93568,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -91175,7 +93605,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -91208,7 +93642,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -91229,7 +93667,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -91336,23 +93778,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91389,23 +93851,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Application\\") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Group\\") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Organization\\") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Person\\") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"https://www.w3.org/ns/activitystreams#Service\\") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ) : undefined ; if (typeof decoded === \\"undefined\\") continue; @@ -91440,7 +93922,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values[\\"@id\\"] == null ? options.baseUrl : new URL(values[\\"@id\\"])) } + { ...options, baseUrl: (values[\\"@id\\"] == null || + values[\\"@id\\"].startsWith(\\"_:\\") || + !URL.canParse(values[\\"@id\\"], options.baseUrl) + ? options.baseUrl + : new URL(values[\\"@id\\"], options.baseUrl)) } ); if (typeof decoded === \\"undefined\\") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -92010,6 +94496,7 @@ export class Source { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -92039,6 +94526,10 @@ export class Source { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Source}: \`https://www.w3.org/ns/activitystreams#Source\`. @@ -92071,6 +94562,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if (\\"$warning\\" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -92476,7 +94969,10 @@ get contents(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -92492,7 +94988,7 @@ get contents(): ((string | LanguageString))[] { } const instance = new this( - { id: \\"@id\\" in values ? new URL(values[\\"@id\\"] as string) : undefined }, + { id: values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"], options.baseUrl) ? new URL(values[\\"@id\\"], options.baseUrl) : undefined }, options, ); const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; @@ -92908,7 +95404,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -93242,7 +95741,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -93792,7 +96294,10 @@ get formerTypes(): ($EntityType)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -94227,7 +96732,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -94566,7 +97074,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -94903,7 +97414,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -95240,7 +97754,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } @@ -95573,7 +98090,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { \\"@id\\"?: string }); } - if (options.baseUrl == null && values[\\"@id\\"] != null) { + if (values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && !URL.canParse(values[\\"@id\\"], options.baseUrl)) { + throw new TypeError(\\"Invalid @id: \\" + values[\\"@id\\"]); + } + if (options.baseUrl == null && values[\\"@id\\"] != null && !values[\\"@id\\"].startsWith(\\"_:\\") && URL.canParse(values[\\"@id\\"])) { options = { ...options, baseUrl: new URL(values[\\"@id\\"]) }; } diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap index d728d1625..8e3eeeff7 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap @@ -1,7 +1,7 @@ // Bun Snapshot v1, https://bun.sh/docs/test/snapshots exports[`generateClasses() 1`] = ` -"// deno-lint-ignore-file ban-unused-ignore no-unused-vars prefer-const verbatim-module-syntax +"// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax import jsonld from "@fedify/vocab-runtime/jsonld"; import { getLogger } from "@logtape/logtape"; import { type Span, SpanStatusCode, type TracerProvider, trace } @@ -28,6 +28,8 @@ import { } from "@fedify/vocab-runtime/temporal"; +import * as _ppM0 from "./preprocessors.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}, @@ -46,6 +48,7 @@ export class Object { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -75,6 +78,10 @@ export class Object { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Object}: \`https://www.w3.org/ns/activitystreams#Object\`. @@ -203,6 +210,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -2334,7 +2343,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "attachment"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#attachment_fromJsonLd(obj, options); + + v = await this.#attachment_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2588,7 +2603,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "attributedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#attribution_fromJsonLd(doc, options); + + v = await this.#attribution_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2684,7 +2705,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "attributedTo"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#attribution_fromJsonLd(obj, options); + + v = await this.#attribution_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2901,7 +2928,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "audience"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#audience_fromJsonLd(doc, options); + + v = await this.#audience_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -2996,7 +3029,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "audience"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#audience_fromJsonLd(obj, options); + + v = await this.#audience_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3257,7 +3296,13 @@ get contents(): ((string | LanguageString))[] { "context"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#context_fromJsonLd(obj, options); + + v = await this.#context_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3525,7 +3570,13 @@ get names(): ((string | LanguageString))[] { "generator"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#generator_fromJsonLd(obj, options); + + v = await this.#generator_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3663,6 +3714,27 @@ get names(): ((string | LanguageString))[] { this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; + if (jsonLd != null && typeof jsonLd === "object") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + + { + const _result = await _ppM0["normalizeLinkToImage"](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as Image; + } + + } + } + try { return await Image.fromJsonLd( jsonLd, @@ -3743,7 +3815,13 @@ get names(): ((string | LanguageString))[] { "icon"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#icon_fromJsonLd(doc, options); + + v = await this.#icon_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3839,7 +3917,13 @@ get names(): ((string | LanguageString))[] { "icon"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#icon_fromJsonLd(obj, options); + + v = await this.#icon_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -3977,6 +4061,27 @@ get names(): ((string | LanguageString))[] { this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; + if (jsonLd != null && typeof jsonLd === "object") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + + { + const _result = await _ppM0["normalizeLinkToImage"](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as Image; + } + + } + } + try { return await Image.fromJsonLd( jsonLd, @@ -4057,7 +4162,13 @@ get names(): ((string | LanguageString))[] { "image"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#image_fromJsonLd(doc, options); + + v = await this.#image_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4153,7 +4264,13 @@ get names(): ((string | LanguageString))[] { "image"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#image_fromJsonLd(obj, options); + + v = await this.#image_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4379,7 +4496,13 @@ get names(): ((string | LanguageString))[] { "inReplyTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#replyTarget_fromJsonLd(doc, options); + + v = await this.#replyTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4474,7 +4597,13 @@ get names(): ((string | LanguageString))[] { "inReplyTo"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#replyTarget_fromJsonLd(obj, options); + + v = await this.#replyTarget_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4700,7 +4829,13 @@ get names(): ((string | LanguageString))[] { "location"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#location_fromJsonLd(doc, options); + + v = await this.#location_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -4795,7 +4930,13 @@ get names(): ((string | LanguageString))[] { "location"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#location_fromJsonLd(obj, options); + + v = await this.#location_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5020,7 +5161,13 @@ get names(): ((string | LanguageString))[] { "preview"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#preview_fromJsonLd(doc, options); + + v = await this.#preview_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5114,7 +5261,13 @@ get names(): ((string | LanguageString))[] { "preview"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#preview_fromJsonLd(obj, options); + + v = await this.#preview_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5344,7 +5497,13 @@ get names(): ((string | LanguageString))[] { "replies"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#replies_fromJsonLd(doc, options); + + v = await this.#replies_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5566,7 +5725,13 @@ get names(): ((string | LanguageString))[] { "shares"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#shares_fromJsonLd(doc, options); + + v = await this.#shares_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -5788,7 +5953,13 @@ get names(): ((string | LanguageString))[] { "likes"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#likes_fromJsonLd(doc, options); + + v = await this.#likes_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6004,7 +6175,13 @@ get names(): ((string | LanguageString))[] { "emojiReactions"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#emojiReactions_fromJsonLd(doc, options); + + v = await this.#emojiReactions_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6272,7 +6449,13 @@ get summaries(): ((string | LanguageString))[] { "tag"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#tag_fromJsonLd(obj, options); + + v = await this.#tag_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6523,7 +6706,13 @@ get urls(): ((URL | Link))[] { "to"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#to_fromJsonLd(doc, options); + + v = await this.#to_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6618,7 +6807,13 @@ get urls(): ((URL | Link))[] { "to"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#to_fromJsonLd(obj, options); + + v = await this.#to_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6835,7 +7030,13 @@ get urls(): ((URL | Link))[] { "bto"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#bto_fromJsonLd(doc, options); + + v = await this.#bto_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -6930,7 +7131,13 @@ get urls(): ((URL | Link))[] { "bto"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#bto_fromJsonLd(obj, options); + + v = await this.#bto_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7147,7 +7354,13 @@ get urls(): ((URL | Link))[] { "cc"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#cc_fromJsonLd(doc, options); + + v = await this.#cc_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7242,7 +7455,13 @@ get urls(): ((URL | Link))[] { "cc"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#cc_fromJsonLd(obj, options); + + v = await this.#cc_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7459,7 +7678,13 @@ get urls(): ((URL | Link))[] { "bcc"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#bcc_fromJsonLd(doc, options); + + v = await this.#bcc_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7554,7 +7779,13 @@ get urls(): ((URL | Link))[] { "bcc"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#bcc_fromJsonLd(obj, options); + + v = await this.#bcc_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7834,7 +8065,13 @@ get urls(): ((URL | Link))[] { "proof"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#proof_fromJsonLd(doc, options); + + v = await this.#proof_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -7928,7 +8165,13 @@ get urls(): ((URL | Link))[] { "proof"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#proof_fromJsonLd(obj, options); + + v = await this.#proof_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8184,7 +8427,13 @@ get urls(): ((URL | Link))[] { "likeAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#likeAuthorization_fromJsonLd(doc, options); + + v = await this.#likeAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8400,7 +8649,13 @@ get urls(): ((URL | Link))[] { "replyAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#replyAuthorization_fromJsonLd(doc, options); + + v = await this.#replyAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -8616,7 +8871,13 @@ get urls(): ((URL | Link))[] { "announceAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#announceAuthorization_fromJsonLd(doc, options); + + v = await this.#announceAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -10164,7 +10425,10 @@ get urls(): ((URL | Link))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -10432,7 +10696,7 @@ get urls(): ((URL | Link))[] { } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); @@ -10465,16 +10729,28 @@ get urls(): ((URL | Link))[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("http://schema.org#PropertyValue") ? await PropertyValue.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10511,23 +10787,43 @@ get urls(): ((URL | Link))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10562,7 +10858,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.push(decoded); @@ -10622,12 +10922,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10711,12 +11019,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10739,6 +11055,32 @@ get urls(): ((URL | Link))[] { ) { if (v == null) continue; + { + let _handled: Image | undefined; + + if (_handled === undefined) { + const _result = await _ppM0["normalizeLinkToImage"](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)), + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as Image; + } + } + + if (_handled !== undefined) { + _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(_handled); + continue; + } + } + if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) { _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push( @@ -10751,7 +11093,11 @@ get urls(): ((URL | Link))[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.push(decoded); @@ -10772,6 +11118,32 @@ get urls(): ((URL | Link))[] { ) { if (v == null) continue; + { + let _handled: Image | undefined; + + if (_handled === undefined) { + const _result = await _ppM0["normalizeLinkToImage"](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)), + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as Image; + } + } + + if (_handled !== undefined) { + _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(_handled); + continue; + } + } + if (typeof v === "object" && "@id" in v && !("@type" in v) && globalThis.Object.keys(v).length === 1) { _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push( @@ -10784,7 +11156,11 @@ get urls(): ((URL | Link))[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3dXrUdkARxwyJLtJcYi1AJ92H41U_image.push(decoded); @@ -10820,12 +11196,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10863,12 +11247,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10906,12 +11298,20 @@ get urls(): ((URL | Link))[] { && 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -10968,7 +11368,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _7UpwM3JWcXhADcscukEehBorf6k_replies.push(decoded); @@ -11001,7 +11405,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3kAfck9PcEYt2L7xug5y99YPbANs_shares.push(decoded); @@ -11034,7 +11442,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.push(decoded); @@ -11067,7 +11479,11 @@ get urls(): ((URL | Link))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.push(decoded); @@ -11149,12 +11565,20 @@ get urls(): ((URL | Link))[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -11213,13 +11637,25 @@ get urls(): ((URL | Link))[] { : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))) : typeof v === "object" && "@type" in v + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -11254,7 +11690,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.push(decoded); @@ -11287,7 +11727,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.push(decoded); @@ -11320,7 +11764,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.push(decoded); @@ -11353,7 +11801,11 @@ get urls(): ((URL | Link))[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.push(decoded); @@ -11428,7 +11880,11 @@ get urls(): ((URL | Link))[] { const decoded = await Source.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.push(decoded); @@ -11461,7 +11917,11 @@ get urls(): ((URL | Link))[] { const decoded = await DataIntegrityProof.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.push(decoded); @@ -11482,7 +11942,11 @@ get urls(): ((URL | Link))[] { const decoded = await InteractionPolicy.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.push(decoded); @@ -11514,9 +11978,17 @@ get urls(): ((URL | Link))[] { : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.push(decoded); } @@ -11548,7 +12020,11 @@ get urls(): ((URL | Link))[] { const decoded = await LikeAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.push(decoded); @@ -11581,7 +12057,11 @@ get urls(): ((URL | Link))[] { const decoded = await ReplyAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.push(decoded); @@ -11614,7 +12094,11 @@ get urls(): ((URL | Link))[] { const decoded = await AnnounceAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.push(decoded); @@ -12792,7 +13276,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -13229,7 +13716,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "quote"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -13468,7 +13961,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "quoteAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -13790,7 +14289,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -13841,7 +14343,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -13900,7 +14406,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -14846,7 +15356,13 @@ instruments?: (Object | URL)[];} "actor"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#actor_fromJsonLd(doc, options); + + v = await this.#actor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -14942,7 +15458,13 @@ instruments?: (Object | URL)[];} "actor"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#actor_fromJsonLd(obj, options); + + v = await this.#actor_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15160,7 +15682,13 @@ instruments?: (Object | URL)[];} "object"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#object_fromJsonLd(doc, options); + + v = await this.#object_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15256,7 +15784,13 @@ instruments?: (Object | URL)[];} "object"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#object_fromJsonLd(obj, options); + + v = await this.#object_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15477,7 +16011,13 @@ instruments?: (Object | URL)[];} "target"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#target_fromJsonLd(doc, options); + + v = await this.#target_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15576,7 +16116,13 @@ instruments?: (Object | URL)[];} "target"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#target_fromJsonLd(obj, options); + + v = await this.#target_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15794,7 +16340,13 @@ instruments?: (Object | URL)[];} "result"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#result_fromJsonLd(doc, options); + + v = await this.#result_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -15890,7 +16442,13 @@ instruments?: (Object | URL)[];} "result"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#result_fromJsonLd(obj, options); + + v = await this.#result_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16109,7 +16667,13 @@ instruments?: (Object | URL)[];} "origin"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#origin_fromJsonLd(doc, options); + + v = await this.#origin_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16206,7 +16770,13 @@ instruments?: (Object | URL)[];} "origin"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#origin_fromJsonLd(obj, options); + + v = await this.#origin_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16423,7 +16993,13 @@ instruments?: (Object | URL)[];} "instrument"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#instrument_fromJsonLd(doc, options); + + v = await this.#instrument_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16518,7 +17094,13 @@ instruments?: (Object | URL)[];} "instrument"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#instrument_fromJsonLd(obj, options); + + v = await this.#instrument_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -16799,7 +17381,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -16988,23 +17573,43 @@ instruments?: (Object | URL)[];} typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -17039,7 +17644,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(decoded); @@ -17072,7 +17681,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.push(decoded); @@ -17105,7 +17718,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.push(decoded); @@ -17138,7 +17755,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _25zu2s3VxVujgEKqrDycjE284XQR_origin.push(decoded); @@ -17171,7 +17792,11 @@ instruments?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.push(decoded); @@ -17642,7 +18267,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -17722,6 +18350,7 @@ export class PropertyValue { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -17751,6 +18380,10 @@ export class PropertyValue { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link PropertyValue}: \`http://schema.org#PropertyValue\`. @@ -17782,6 +18415,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -18145,7 +18780,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -18161,7 +18799,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; @@ -18323,6 +18961,7 @@ export class Measure { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -18352,6 +18991,10 @@ export class Measure { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Measure}: \`http://www.ontology-of-units-of-measure.org/resource/om-2/Measure\`. @@ -18383,6 +19026,8 @@ unit?: string | null;numericalValue?: Decimal | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -18731,7 +19376,10 @@ unit?: string | null;numericalValue?: Decimal | null;} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -18747,7 +19395,7 @@ unit?: string | null;numericalValue?: Decimal | null;} } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _27fgyFbosTtMAhuepJH8K3ZGURT6: (string)[] = []; @@ -19230,7 +19878,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactingObject"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -19445,7 +20099,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactionTarget"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -19722,7 +20382,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -19773,7 +20436,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -19806,7 +20473,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -20171,7 +20842,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -20258,6 +20932,7 @@ export class InteractionPolicy { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -20287,6 +20962,10 @@ export class InteractionPolicy { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link InteractionPolicy}: \`https://gotosocial.org/ns#InteractionPolicy\`. @@ -20320,6 +20999,8 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -20762,7 +21443,10 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -20778,7 +21462,7 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike: (InteractionRule)[] = []; @@ -20796,7 +21480,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.push(decoded); @@ -20817,7 +21505,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.push(decoded); @@ -20838,7 +21530,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.push(decoded); @@ -20859,7 +21555,11 @@ canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.push(decoded); @@ -21034,6 +21734,7 @@ export class InteractionRule { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -21063,6 +21764,10 @@ export class InteractionRule { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link InteractionRule}: \`https://gotosocial.org/ns#InteractionRule\`. @@ -21096,6 +21801,8 @@ manualApprovals?: (URL)[];} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -21510,7 +22217,10 @@ get manualApprovals(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -21526,7 +22236,7 @@ get manualApprovals(): (URL)[] { } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval: (URL)[] = []; @@ -21555,9 +22265,17 @@ get manualApprovals(): (URL)[] { : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.push(decoded); } @@ -21588,9 +22306,17 @@ get manualApprovals(): (URL)[] { : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.push(decoded); } @@ -22050,7 +22776,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactingObject"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -22265,7 +22997,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactionTarget"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -22542,7 +23280,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -22593,7 +23334,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -22626,7 +23371,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -22990,7 +23739,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -23402,7 +24154,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactingObject"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -23617,7 +24375,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactionTarget"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -23894,7 +24658,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -23945,7 +24712,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -23978,7 +24749,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -24342,7 +25117,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -24753,7 +25531,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactingObject"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactingObject_fromJsonLd(doc, options); + + v = await this.#interactingObject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -24968,7 +25752,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "interactionTarget"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#interactionTarget_fromJsonLd(doc, options); + + v = await this.#interactionTarget_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -25245,7 +26035,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -25296,7 +26089,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.push(decoded); @@ -25329,7 +26126,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.push(decoded); @@ -25693,7 +26494,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -25777,6 +26581,7 @@ export class DidService { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -25806,6 +26611,10 @@ export class DidService { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link DidService}: \`https://www.w3.org/ns/did#Service\`. @@ -25837,6 +26646,8 @@ endpoints?: (URL)[];} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -26138,7 +26949,10 @@ get endpoints(): (URL)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -26158,7 +26972,7 @@ get endpoints(): (URL)[] { } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint: (URL)[] = []; @@ -26187,9 +27001,17 @@ get endpoints(): (URL)[] { : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.push(decoded); } @@ -26491,7 +27313,10 @@ endpoints?: (URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -26573,6 +27398,7 @@ export class DataIntegrityProof { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -26602,6 +27428,10 @@ export class DataIntegrityProof { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link DataIntegrityProof}: \`https://w3id.org/security#DataIntegrityProof\`. @@ -26638,6 +27468,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -27309,7 +28141,10 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -27325,7 +28160,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: ("eddsa-jcs-2022")[] = []; @@ -27373,7 +28208,11 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.push(decoded); @@ -27608,6 +28447,7 @@ export class CryptographicKey { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -27637,6 +28477,10 @@ export class CryptographicKey { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link CryptographicKey}: \`https://w3id.org/security#Key\`. @@ -27670,6 +28514,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -27999,7 +28845,13 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi "owner"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#owner_fromJsonLd(doc, options); + + v = await this.#owner_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -28274,7 +29126,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -28290,7 +29145,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); @@ -28322,23 +29177,43 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -28479,6 +29354,7 @@ export class Multikey { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -28508,6 +29384,10 @@ export class Multikey { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Multikey}: \`https://w3id.org/security#Multikey\`. @@ -28541,6 +29421,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -28870,7 +29752,13 @@ controller?: Application | Group | Organization | Person | Service | URL | null; "controller"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#controller_fromJsonLd(doc, options); + + v = await this.#controller_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -29152,7 +30040,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -29168,7 +30059,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); @@ -29200,23 +30091,43 @@ controller?: Application | Group | Organization | Person | Service | URL | null; typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -29355,6 +30266,7 @@ export class Intent { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -29384,6 +30296,10 @@ export class Intent { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Intent}: \`https://w3id.org/valueflows/ont/vf#Intent\`. @@ -29418,6 +30334,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -29987,7 +30905,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -30003,7 +30924,7 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action: (string)[] = []; @@ -30050,9 +30971,17 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.push(decoded); } @@ -30072,7 +31001,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.push(decoded); @@ -30093,7 +31026,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.push(decoded); @@ -30114,7 +31051,11 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.push(decoded); @@ -30859,7 +31800,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -30916,7 +31860,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.push(decoded); @@ -30937,7 +31885,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.push(decoded); @@ -31352,7 +32304,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -31692,7 +32647,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -32027,7 +32985,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -33303,7 +34264,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33396,7 +34363,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33615,7 +34588,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33712,7 +34691,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -33968,7 +34953,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "inbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34201,7 +35192,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "outbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34420,7 +35417,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "following"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34642,7 +35645,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "followers"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -34862,7 +35871,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "liked"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35080,7 +36095,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featured"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35298,7 +36319,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featuredTags"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35514,7 +36541,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "streams"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -35840,7 +36873,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "movedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36094,7 +37133,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36191,7 +37236,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36410,7 +37461,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -36507,7 +37564,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -37540,7 +38603,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -37615,7 +38681,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -37648,7 +38718,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -37701,11 +38775,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -37742,11 +38824,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -37781,7 +38871,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -37814,7 +38908,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -37847,7 +38945,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -37880,7 +38982,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -37913,7 +39019,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -37946,7 +39056,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -37967,7 +39081,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -38074,23 +39192,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -38127,23 +39265,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -38178,7 +39336,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -39003,7 +40165,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -39350,7 +40515,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -39782,7 +40950,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "quote"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -40021,7 +41195,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "quoteAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -40343,7 +41523,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -40394,7 +41577,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -40453,7 +41640,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -40984,7 +42175,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -41413,7 +42607,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -41747,7 +42944,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -42087,7 +43287,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -42842,7 +44045,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "current"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#current_fromJsonLd(doc, options); + + v = await this.#current_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43058,7 +44267,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "first"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#first_fromJsonLd(doc, options); + + v = await this.#first_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43274,7 +44489,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "last"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#last_fromJsonLd(doc, options); + + v = await this.#last_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43500,7 +44721,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "items"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43716,7 +44943,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "likesOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#likesOf_fromJsonLd(doc, options); + + v = await this.#likesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -43931,7 +45164,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "sharesOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#sharesOf_fromJsonLd(doc, options); + + v = await this.#sharesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44146,7 +45385,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "repliesOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#repliesOf_fromJsonLd(doc, options); + + v = await this.#repliesOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44361,7 +45606,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "inboxOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#inboxOf_fromJsonLd(doc, options); + + v = await this.#inboxOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44576,7 +45827,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "outboxOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#outboxOf_fromJsonLd(doc, options); + + v = await this.#outboxOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -44791,7 +46048,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "followersOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followersOf_fromJsonLd(doc, options); + + v = await this.#followersOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45006,7 +46269,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "followingOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followingOf_fromJsonLd(doc, options); + + v = await this.#followingOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45221,7 +46490,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "likedOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#likedOf_fromJsonLd(doc, options); + + v = await this.#likedOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -45886,7 +47161,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -45967,7 +47245,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3UyUdxnyn6cDn53QKrh4MBiearma_current.push(decoded); @@ -46000,7 +47282,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _J52RqweMe6hhv7RnLJMC8BExTE5_first.push(decoded); @@ -46033,7 +47319,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.push(decoded); @@ -46069,12 +47359,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -46109,7 +47407,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.push(decoded); @@ -46142,7 +47444,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.push(decoded); @@ -46175,7 +47481,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.push(decoded); @@ -46208,7 +47518,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.push(decoded); @@ -46241,7 +47555,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.push(decoded); @@ -46274,7 +47592,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.push(decoded); @@ -46307,7 +47629,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.push(decoded); @@ -46340,7 +47666,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.push(decoded); @@ -47020,7 +48350,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "partOf"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#partOf_fromJsonLd(doc, options); + + v = await this.#partOf_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47234,7 +48570,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "next"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#next_fromJsonLd(doc, options); + + v = await this.#next_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47449,7 +48791,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "prev"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#prev_fromJsonLd(doc, options); + + v = await this.#prev_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -47761,7 +49109,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -47816,7 +49167,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.push(decoded); @@ -47849,7 +49204,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.push(decoded); @@ -47882,7 +49241,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.push(decoded); @@ -48256,7 +49619,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -48590,7 +49956,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -48922,7 +50291,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -49002,6 +50374,7 @@ export class Endpoints { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -49031,6 +50404,10 @@ export class Endpoints { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Endpoints}: \`https://www.w3.org/ns/activitystreams#Endpoints\`. @@ -49066,6 +50443,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -49716,7 +51095,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -49732,7 +51114,7 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl: (URL)[] = []; @@ -49761,9 +51143,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.push(decoded); } @@ -49794,9 +51184,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.push(decoded); } @@ -49827,9 +51225,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.push(decoded); } @@ -49860,9 +51266,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.push(decoded); } @@ -49893,9 +51307,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.push(decoded); } @@ -49926,9 +51348,17 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.push(decoded); } @@ -50381,7 +51811,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -50716,7 +52149,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -51052,7 +52488,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -52328,7 +53767,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52421,7 +53866,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52640,7 +54091,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52737,7 +54194,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -52993,7 +54456,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "inbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53226,7 +54695,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "outbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53445,7 +54920,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "following"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53667,7 +55148,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "followers"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -53887,7 +55374,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "liked"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54105,7 +55598,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featured"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54323,7 +55822,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featuredTags"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54539,7 +56044,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "streams"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -54865,7 +56376,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "movedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55119,7 +56636,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55216,7 +56739,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55435,7 +56964,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -55532,7 +57067,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -56565,7 +58106,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -56640,7 +58184,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -56673,7 +58221,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -56726,11 +58278,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -56767,11 +58327,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -56806,7 +58374,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -56839,7 +58411,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -56872,7 +58448,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -56905,7 +58485,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -56938,7 +58522,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -56971,7 +58559,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -56992,7 +58584,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -57099,23 +58695,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -57152,23 +58768,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -57203,7 +58839,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -57781,6 +59421,7 @@ export class Link { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -57810,6 +59451,10 @@ export class Link { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Link}: \`https://www.w3.org/ns/activitystreams#Link\`. @@ -57851,6 +59496,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -58540,7 +60187,13 @@ get names(): ((string | LanguageString))[] { "preview"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#preview_fromJsonLd(obj, options); + + v = await this.#preview_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -58994,7 +60647,10 @@ get names(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -59018,7 +60674,7 @@ get names(): ((string | LanguageString))[] { } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _pVjLsybKQdmkjuU7MHjiVmNnuj7_href: (URL)[] = []; @@ -59047,9 +60703,17 @@ get names(): ((string | LanguageString))[] { : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))); + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))); if (typeof decoded === "undefined") continue; _pVjLsybKQdmkjuU7MHjiVmNnuj7_href.push(decoded); } @@ -59198,12 +60862,20 @@ get names(): ((string | LanguageString))[] { && 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -59677,7 +61349,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -60014,7 +61689,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -60349,7 +62027,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -60687,7 +62368,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -61021,7 +62705,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -61355,7 +63042,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -61689,7 +63379,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -62021,7 +63714,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -62319,7 +64015,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -62654,7 +64353,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -63088,7 +64790,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "quote"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -63327,7 +65035,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "quoteAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -63649,7 +65363,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -63700,7 +65417,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -63759,7 +65480,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -64201,7 +65926,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "orderedItems"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -64445,7 +66176,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -64499,12 +66233,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -64938,7 +66680,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "orderedItems"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#item_fromJsonLd(obj, options); + + v = await this.#item_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -65231,7 +66979,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -65285,12 +67036,20 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#Object","http://joinmastodon.org/ns#Emoji","http://litepub.social/ns#ChatMessage","https://gotosocial.org/ns#AnnounceAuthorization","https://gotosocial.org/ns#LikeApproval","https://gotosocial.org/ns#ReplyAuthorization","https://w3id.org/fep/044f#QuoteAuthorization","https://w3id.org/valueflows/ont/vf#Proposal","https://www.w3.org/ns/activitystreams#Activity","http://litepub.social/ns#EmojiReact","https://gotosocial.org/ns#AnnounceRequest","https://gotosocial.org/ns#LikeRequest","https://gotosocial.org/ns#ReplyRequest","https://w3id.org/fep/044f#QuoteRequest","https://www.w3.org/ns/activitystreams#Accept","https://www.w3.org/ns/activitystreams#TentativeAccept","https://www.w3.org/ns/activitystreams#Add","https://www.w3.org/ns/activitystreams#Announce","https://www.w3.org/ns/activitystreams#Create","https://www.w3.org/ns/activitystreams#Delete","https://www.w3.org/ns/activitystreams#Dislike","https://www.w3.org/ns/activitystreams#Flag","https://www.w3.org/ns/activitystreams#Follow","https://www.w3.org/ns/activitystreams#Ignore","https://www.w3.org/ns/activitystreams#Block","https://www.w3.org/ns/activitystreams#IntransitiveActivity","https://www.w3.org/ns/activitystreams#Arrive","https://www.w3.org/ns/activitystreams#Question","https://www.w3.org/ns/activitystreams#Travel","https://www.w3.org/ns/activitystreams#Join","https://www.w3.org/ns/activitystreams#Leave","https://www.w3.org/ns/activitystreams#Like","https://www.w3.org/ns/activitystreams#Listen","https://www.w3.org/ns/activitystreams#Move","https://www.w3.org/ns/activitystreams#Offer","https://www.w3.org/ns/activitystreams#Invite","https://www.w3.org/ns/activitystreams#Read","https://www.w3.org/ns/activitystreams#Reject","https://www.w3.org/ns/activitystreams#TentativeReject","https://www.w3.org/ns/activitystreams#Remove","https://www.w3.org/ns/activitystreams#Undo","https://www.w3.org/ns/activitystreams#Update","https://www.w3.org/ns/activitystreams#View","https://www.w3.org/ns/activitystreams#Application","https://www.w3.org/ns/activitystreams#Article","https://www.w3.org/ns/activitystreams#Collection","https://www.w3.org/ns/activitystreams#CollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollectionPage","https://www.w3.org/ns/activitystreams#OrderedCollection","https://www.w3.org/ns/activitystreams#Document","https://www.w3.org/ns/activitystreams#Audio","https://www.w3.org/ns/activitystreams#Image","https://www.w3.org/ns/activitystreams#Page","https://www.w3.org/ns/activitystreams#Video","https://www.w3.org/ns/activitystreams#Event","https://www.w3.org/ns/activitystreams#Group","https://www.w3.org/ns/activitystreams#Note","https://www.w3.org/ns/activitystreams#Organization","https://www.w3.org/ns/activitystreams#Person","https://www.w3.org/ns/activitystreams#Place","https://www.w3.org/ns/activitystreams#Profile","https://www.w3.org/ns/activitystreams#Relationship","https://www.w3.org/ns/activitystreams#Service","https://www.w3.org/ns/activitystreams#Tombstone"].some( t => v["@type"].includes(t)) ? await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -66610,7 +68369,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -66703,7 +68468,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -66922,7 +68693,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67019,7 +68796,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67275,7 +69058,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "inbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67508,7 +69297,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "outbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67727,7 +69522,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "following"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -67949,7 +69750,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "followers"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68169,7 +69976,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "liked"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68387,7 +70200,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featured"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68605,7 +70424,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featuredTags"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -68821,7 +70646,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "streams"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69147,7 +70978,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "movedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69401,7 +71238,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69498,7 +71341,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69717,7 +71566,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -69814,7 +71669,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -70847,7 +72708,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -70922,7 +72786,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -70955,7 +72823,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -71008,11 +72880,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -71049,11 +72929,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -71088,7 +72976,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -71121,7 +73013,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -71154,7 +73050,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -71187,7 +73087,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -71220,7 +73124,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -71253,7 +73161,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -71274,7 +73186,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -71381,23 +73297,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -71434,23 +73370,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -71485,7 +73441,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -72312,7 +74272,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -73588,7 +75551,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73681,7 +75650,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73900,7 +75875,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -73997,7 +75978,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74253,7 +76240,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "inbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74486,7 +76479,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "outbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74705,7 +76704,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "following"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -74927,7 +76932,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "followers"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75147,7 +77158,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "liked"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75365,7 +77382,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featured"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75583,7 +77606,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featuredTags"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -75799,7 +77828,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "streams"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76125,7 +78160,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "movedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76379,7 +78420,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76476,7 +78523,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76695,7 +78748,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -76792,7 +78851,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -77825,7 +79890,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -77900,7 +79968,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -77933,7 +80005,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -77986,11 +80062,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -78027,11 +80111,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -78066,7 +80158,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -78099,7 +80195,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -78132,7 +80232,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -78165,7 +80269,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -78198,7 +80306,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -78231,7 +80343,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -78252,7 +80368,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -78359,23 +80479,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -78412,23 +80552,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -78463,7 +80623,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -79746,7 +81910,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -79890,9 +82057,17 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu : "" ) ) - : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) + : URL.canParse(v["@id"]) && (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) ? new URL(v["@id"]) - : new URL(v["@id"], (values["@id"] == null ? options.baseUrl : new URL(values["@id"]))) : undefined + : new URL(v["@id"], (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))) : undefined ; if (typeof decoded === "undefined") continue; _oKrwxU4V8wiKhMW1QEYQibcJh8c_units.push(decoded); @@ -80375,7 +82550,13 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu "describes"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#describes_fromJsonLd(doc, options); + + v = await this.#describes_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -80617,7 +82798,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -80668,7 +82852,11 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.push(decoded); @@ -81261,7 +83449,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti "oneOf"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#exclusiveOption_fromJsonLd(obj, options); + + v = await this.#exclusiveOption_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81480,7 +83674,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti "anyOf"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#inclusiveOption_fromJsonLd(obj, options); + + v = await this.#inclusiveOption_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81728,7 +83928,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti "quote"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quote_fromJsonLd(doc, options); + + v = await this.#quote_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -81967,7 +84173,13 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti "quoteAuthorization"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#quoteAuthorization_fromJsonLd(doc, options); + + v = await this.#quoteAuthorization_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -82272,7 +84484,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -82323,7 +84538,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.push(decoded); @@ -82356,7 +84575,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.push(decoded); @@ -82438,7 +84661,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.push(decoded); @@ -82497,7 +84724,11 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.push(decoded); @@ -82956,7 +85187,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -83290,7 +85524,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -83850,7 +86087,13 @@ relationships?: (Object | URL)[];} "subject"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#subject_fromJsonLd(doc, options); + + v = await this.#subject_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84065,7 +86308,13 @@ relationships?: (Object | URL)[];} "object"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#object_fromJsonLd(doc, options); + + v = await this.#object_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84159,7 +86408,13 @@ relationships?: (Object | URL)[];} "object"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#object_fromJsonLd(obj, options); + + v = await this.#object_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84377,7 +86632,13 @@ relationships?: (Object | URL)[];} "relationship"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#relationship_fromJsonLd(doc, options); + + v = await this.#relationship_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84473,7 +86734,13 @@ relationships?: (Object | URL)[];} "relationship"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#relationship_fromJsonLd(obj, options); + + v = await this.#relationship_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -84786,7 +87053,10 @@ relationships?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -84837,7 +87107,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.push(decoded); @@ -84870,7 +87144,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.push(decoded); @@ -84903,7 +87181,11 @@ relationships?: (Object | URL)[];} const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.push(decoded); @@ -85291,7 +87573,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -86567,7 +88852,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#publicKey_fromJsonLd(doc, options); + + v = await this.#publicKey_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86660,7 +88951,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "publicKey"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#publicKey_fromJsonLd(obj, options); + + v = await this.#publicKey_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86879,7 +89176,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#assertionMethod_fromJsonLd(doc, options); + + v = await this.#assertionMethod_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -86976,7 +89279,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "assertionMethod"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#assertionMethod_fromJsonLd(obj, options); + + v = await this.#assertionMethod_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87232,7 +89541,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "inbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#inbox_fromJsonLd(doc, options); + + v = await this.#inbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87465,7 +89780,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "outbox"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#outbox_fromJsonLd(doc, options); + + v = await this.#outbox_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87684,7 +90005,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "following"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#following_fromJsonLd(doc, options); + + v = await this.#following_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -87906,7 +90233,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "followers"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#followers_fromJsonLd(doc, options); + + v = await this.#followers_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88126,7 +90459,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "liked"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#liked_fromJsonLd(doc, options); + + v = await this.#liked_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88344,7 +90683,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featured"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featured_fromJsonLd(doc, options); + + v = await this.#featured_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88562,7 +90907,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "featuredTags"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#featuredTags_fromJsonLd(doc, options); + + v = await this.#featuredTags_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -88778,7 +91129,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "streams"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#stream_fromJsonLd(obj, options); + + v = await this.#stream_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89104,7 +91461,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "movedTo"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#successor_fromJsonLd(doc, options); + + v = await this.#successor_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89358,7 +91721,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#alias_fromJsonLd(doc, options); + + v = await this.#alias_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89455,7 +91824,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "alsoKnownAs"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#alias_fromJsonLd(obj, options); + + v = await this.#alias_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89674,7 +92049,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#service_fromJsonLd(doc, options); + + v = await this.#service_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -89771,7 +92152,13 @@ get preferredUsernames(): ((string | LanguageString))[] { "service"]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#service_fromJsonLd(obj, options); + + v = await this.#service_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + } } @@ -90804,7 +93191,10 @@ get preferredUsernames(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -90879,7 +93269,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _axq166E2eZADq34V4MYUc8KMZdC_publicKey.push(decoded); @@ -90912,7 +93306,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.push(decoded); @@ -90965,11 +93363,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -91006,11 +93412,19 @@ get preferredUsernames(): ((string | LanguageString))[] { 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : 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, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -91045,7 +93459,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.push(decoded); @@ -91078,7 +93496,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _BBCTgfphhsFzpVfKTykGSpBNwoA_followers.push(decoded); @@ -91111,7 +93533,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.push(decoded); @@ -91144,7 +93570,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4N1vBJzXDf8NbBumeECQMFvKetja_featured.push(decoded); @@ -91177,7 +93607,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.push(decoded); @@ -91210,7 +93644,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.push(decoded); @@ -91231,7 +93669,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.push(decoded); @@ -91338,23 +93780,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -91391,23 +93853,43 @@ get preferredUsernames(): ((string | LanguageString))[] { typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Application") ? await Application.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Group") ? await Group.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Organization") ? await Organization.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Person") ? await Person.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("https://www.w3.org/ns/activitystreams#Service") ? await Service.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ) : undefined ; if (typeof decoded === "undefined") continue; @@ -91442,7 +93924,11 @@ get preferredUsernames(): ((string | LanguageString))[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) } + { ...options, baseUrl: (values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl)) } ); if (typeof decoded === "undefined") continue; _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.push(decoded); @@ -92012,6 +94498,7 @@ export class Source { values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -92041,6 +94528,10 @@ export class Source { protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } /** * The type URI of {@link Source}: \`https://www.w3.org/ns/activitystreams#Source\`. @@ -92073,6 +94564,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; @@ -92478,7 +94971,10 @@ get contents(): ((string | LanguageString))[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -92494,7 +94990,7 @@ get contents(): ((string | LanguageString))[] { } const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); const _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; @@ -92910,7 +95406,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -93244,7 +95743,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -93794,7 +96296,10 @@ get formerTypes(): ($EntityType)[] { // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -94229,7 +96734,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -94568,7 +97076,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -94905,7 +97416,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -95242,7 +97756,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } @@ -95575,7 +98092,10 @@ instruments?: (Object | URL)[];} // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } diff --git a/packages/vocab-tools/src/class.ts b/packages/vocab-tools/src/class.ts index 9ae7e7a00..d1943554e 100644 --- a/packages/vocab-tools/src/class.ts +++ b/packages/vocab-tools/src/class.ts @@ -37,6 +37,7 @@ export function sortTopologically(types: Record): string[] { async function* generateClass( typeUri: string, types: Record, + moduleVarNames: ReadonlyMap, ): AsyncIterable { const type = types[typeUri]; yield `/** ${type.description.replaceAll("\n", "\n * ")}\n */\n`; @@ -57,6 +58,7 @@ async function* generateClass( values?: Record; }; #cachedJsonLd?: unknown; + readonly #_baseUrl?: URL; readonly id: URL | null; protected get _documentLoader(): DocumentLoader | undefined { @@ -86,6 +88,10 @@ async function* generateClass( protected set _cachedJsonLd(value: unknown | undefined) { this.#cachedJsonLd = value; } + + protected get _baseUrl(): URL | undefined { + return this.#_baseUrl; + } `; } yield ` @@ -99,9 +105,13 @@ async function* generateClass( for await (const code of generateFields(typeUri, types)) yield code; for await (const code of generateConstructor(typeUri, types)) yield code; for await (const code of generateCloner(typeUri, types)) yield code; - for await (const code of generateProperties(typeUri, types)) yield code; + for await (const code of generateProperties(typeUri, types, moduleVarNames)) { + yield code; + } for await (const code of generateEncoder(typeUri, types)) yield code; - for await (const code of generateDecoder(typeUri, types)) yield code; + for await (const code of generateDecoder(typeUri, types, moduleVarNames)) { + yield code; + } for await (const code of generateInspector(typeUri, types)) yield code; yield "}\n\n"; for await (const code of generateInspectorPostClass(typeUri, types)) { @@ -184,7 +194,7 @@ export async function* generateClasses( "parseDecimal", "type RemoteDocument", ]; - yield "// deno-lint-ignore-file ban-unused-ignore no-unused-vars prefer-const verbatim-module-syntax\n"; + yield "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax\n"; yield 'import jsonld from "@fedify/vocab-runtime/jsonld";\n'; yield 'import { getLogger } from "@logtape/logtape";\n'; yield `import { type Span, SpanStatusCode, type TracerProvider, trace } @@ -197,9 +207,27 @@ export async function* generateClasses( isTemporalInstant, } from "@fedify/vocab-runtime/temporal";\n`; yield "\n\n"; + const moduleVarNames = new Map(); const sorted = sortTopologically(types); for (const typeUri of sorted) { - for await (const code of generateClass(typeUri, types)) yield code; + for (const property of types[typeUri].properties) { + if (property.preprocessors == null) continue; + for (const pp of property.preprocessors) { + if (!moduleVarNames.has(pp.module)) { + const name = `_ppM${moduleVarNames.size}`; + moduleVarNames.set(pp.module, name); + } + } + } + } + for (const [modulePath, varName] of moduleVarNames) { + yield `import * as ${varName} from ${JSON.stringify(modulePath)};\n`; + } + if (moduleVarNames.size > 0) yield "\n"; + for (const typeUri of sorted) { + for await (const code of generateClass(typeUri, types, moduleVarNames)) { + yield code; + } } for (const code of generateEntityTypeHelpers(sorted, types)) yield code; } diff --git a/packages/vocab-tools/src/codec.ts b/packages/vocab-tools/src/codec.ts index 7c0b4d2b6..f01d2f2e6 100644 --- a/packages/vocab-tools/src/codec.ts +++ b/packages/vocab-tools/src/codec.ts @@ -1,6 +1,6 @@ import metadata from "../deno.json" with { type: "json" }; import { generateField, getFieldName } from "./field.ts"; -import type { TypeSchema } from "./schema.ts"; +import type { PropertyPreprocessorSchema, TypeSchema } from "./schema.ts"; import { isNonFunctionalProperty } from "./schema.ts"; import { areAllScalarTypes, @@ -10,9 +10,57 @@ import { getDecoders, getEncoders, getSubtypes, + getTypeNames, isCompactableType, } from "./type.ts"; +function* generatePreprocessorBlock( + property: { preprocessors?: PropertyPreprocessorSchema[] }, + rangeTypeName: string, + variable: string, + baseUrlExpr: string, + moduleVarNames: ReadonlyMap, +): Iterable { + if (property.preprocessors == null || property.preprocessors.length === 0) { + return; + } + yield ` + { + let _handled: ${rangeTypeName} | undefined; + `; + for (const pp of property.preprocessors) { + const varName = moduleVarNames.get(pp.module); + if (varName == null) { + throw new Error( + `Preprocessor module "${pp.module}" is not registered ` + + `in the generated imports. Ensure all preprocessor ` + + `modules used in property schemas are available.`, + ); + } + yield ` + if (_handled === undefined) { + const _result = await ${varName}[${JSON.stringify(pp.function)}](v, { + documentLoader: options.documentLoader, + contextLoader: options.contextLoader, + tracerProvider: options.tracerProvider, + baseUrl: ${baseUrlExpr}, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) { + _handled = _result as ${rangeTypeName}; + } + } + `; + } + yield ` + if (_handled !== undefined) { + ${variable}.push(_handled); + continue; + } + } + `; +} + export async function* generateEncoder( typeUri: string, types: Record, @@ -271,6 +319,7 @@ export async function* generateEncoder( export async function* generateDecoder( typeUri: string, types: Record, + moduleVarNames: ReadonlyMap, ): AsyncIterable { const type = types[typeUri]; yield ` @@ -355,7 +404,10 @@ export async function* generateDecoder( // deno-lint-ignore no-explicit-any (expanded[0] ?? {}) as (Record & { "@id"?: string }); } - if (options.baseUrl == null && values["@id"] != null) { + if (values["@id"] != null && !values["@id"].startsWith("_:") && !URL.canParse(values["@id"], options.baseUrl)) { + throw new TypeError("Invalid @id: " + values["@id"]); + } + if (options.baseUrl == null && values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"])) { options = { ...options, baseUrl: new URL(values["@id"]) }; } `; @@ -383,7 +435,7 @@ export async function* generateDecoder( if (type.extends == null) { yield ` const instance = new this( - { id: "@id" in values ? new URL(values["@id"] as string) : undefined }, + { id: values["@id"] != null && !values["@id"].startsWith("_:") && URL.canParse(values["@id"], options.baseUrl) ? new URL(values["@id"], options.baseUrl) : undefined }, options, ); `; @@ -426,6 +478,18 @@ export async function* generateDecoder( ) { if (v == null) continue; `; + const propertyBaseUrl = `(values["@id"] == null || + values["@id"].startsWith("_:") || + !URL.canParse(values["@id"], options.baseUrl) + ? options.baseUrl + : new URL(values["@id"], options.baseUrl))`; + yield* generatePreprocessorBlock( + property, + getTypeNames(property.range, types), + variable, + propertyBaseUrl, + moduleVarNames, + ); if (!areAllScalarTypes(property.range, types)) { yield ` if (typeof v === "object" && "@id" in v && !("@type" in v) @@ -447,7 +511,7 @@ export async function* generateDecoder( types, "v", "options", - `(values["@id"] == null ? options.baseUrl : new URL(values["@id"]))`, + propertyBaseUrl, ) }; if (typeof decoded === "undefined") continue; @@ -461,7 +525,7 @@ export async function* generateDecoder( types, "v", "options", - `(values["@id"] == null ? options.baseUrl : new URL(values["@id"]))`, + propertyBaseUrl, ); for (const code of decoders) yield code; yield ` diff --git a/packages/vocab-tools/src/constructor.ts b/packages/vocab-tools/src/constructor.ts index 575e7b449..ed07715cf 100644 --- a/packages/vocab-tools/src/constructor.ts +++ b/packages/vocab-tools/src/constructor.ts @@ -97,6 +97,8 @@ export async function* generateConstructor( this.#documentLoader = options.documentLoader; this.#contextLoader = options.contextLoader; this.#tracerProvider = options.tracerProvider; + const baseUrl = (options as { baseUrl?: URL }).baseUrl; + this.#_baseUrl = baseUrl == null ? undefined : new URL(baseUrl.href); if ("$warning" in options) { this.#warning = options.$warning as unknown as { category: string[]; diff --git a/packages/vocab-tools/src/mod.ts b/packages/vocab-tools/src/mod.ts index 5cd50a54e..0cd6bdc1e 100644 --- a/packages/vocab-tools/src/mod.ts +++ b/packages/vocab-tools/src/mod.ts @@ -1,6 +1,7 @@ export { default as generateVocab } from "./generate.ts"; export { loadSchemaFiles, + type PropertyPreprocessorSchema, type PropertySchema, type TypeSchema, } from "./schema.ts"; diff --git a/packages/vocab-tools/src/property.ts b/packages/vocab-tools/src/property.ts index 78c1772c3..082302c8b 100644 --- a/packages/vocab-tools/src/property.ts +++ b/packages/vocab-tools/src/property.ts @@ -26,6 +26,7 @@ async function* generateProperty( type: TypeSchema, property: PropertySchema, types: Record, + moduleVarNames: ReadonlyMap, ): AsyncIterable { const override = emitOverride(type.uri, types, property); const doc = `\n/** ${property.description.replaceAll("\n", "\n * ")}\n */\n`; @@ -165,6 +166,49 @@ async function* generateProperty( this._tracerProvider ?? trace.getTracerProvider(); const baseUrl = options.baseUrl; `; + if ( + property.preprocessors != null && + property.preprocessors.length > 0 + ) { + yield ` + if (jsonLd != null && typeof jsonLd === "object") { + const _expanded = await jsonld.expand(jsonLd, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + for (const _pp_obj of _expanded) { + `; + for (const pp of property.preprocessors) { + const varName = moduleVarNames.get(pp.module); + if (varName == null) { + throw new Error( + `Preprocessor module "${pp.module}" is not registered ` + + `in the generated imports. Ensure all preprocessor ` + + `modules used in property schemas are available.`, + ); + } + yield ` + { + const _result = await ${varName}[${ + JSON.stringify(pp.function) + }](_pp_obj, { + documentLoader, + contextLoader, + tracerProvider, + baseUrl, + }); + if (_result instanceof Error) throw _result; + if (_result !== undefined) return _result as ${ + getTypeNames(property.range, types) + }; + } + `; + } + yield ` + } + } + `; + } for (const range of property.range) { if (!(range in types)) continue; const rangeType = types[range]; @@ -251,7 +295,15 @@ async function* generateProperty( ${JSON.stringify(property.compactName)}]; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { - v = await this.#${property.singularName}_fromJsonLd(doc, options); + `; + yield ` + v = await this.#${property.singularName}_fromJsonLd(doc, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + `; + yield ` } } `; @@ -350,7 +402,15 @@ async function* generateProperty( ${JSON.stringify(property.compactName)}]; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { - v = await this.#${property.singularName}_fromJsonLd(obj, options); + `; + yield ` + v = await this.#${property.singularName}_fromJsonLd(obj, { + ...options, + baseUrl: (options as { baseUrl?: URL }).baseUrl ?? this.id ?? + this._baseUrl, + }); + `; + yield ` } } `; @@ -389,9 +449,10 @@ async function* generateProperty( export async function* generateProperties( typeUri: string, types: Record, + moduleVarNames: ReadonlyMap, ): AsyncIterable { const type = types[typeUri]; for (const property of type.properties) { - yield* generateProperty(type, property, types); + yield* generateProperty(type, property, types, moduleVarNames); } } diff --git a/packages/vocab-tools/src/schema.ts b/packages/vocab-tools/src/schema.ts index 123ec7b60..089d5ebe2 100644 --- a/packages/vocab-tools/src/schema.ts +++ b/packages/vocab-tools/src/schema.ts @@ -122,6 +122,33 @@ export interface PropertySchemaBase { */ inherit: true; }; + + /** + * Preprocessors for this property. Each preprocessor receives an expanded + * JSON-LD property value and may return a vocabulary object matching the + * property's declared range, `undefined` when it did not handle the value, + * or an `Error` when it recognized the value but failed while converting it. + * + * `module` is resolved from the generated vocabulary source file + * and imported statically at the top of the generated file. + */ + preprocessors?: PropertyPreprocessorSchema[]; +} + +/** + * A schema for a property preprocessor that normalizes wire-level values + * before the generated range decoder runs. + */ +export interface PropertyPreprocessorSchema { + /** + * Module specifier resolved from the generated vocabulary source file. + */ + module: string; + + /** + * The name of the exported function in the module. + */ + function: string; } export type PropertySchemaTyping = { diff --git a/packages/vocab-tools/src/schema.yaml b/packages/vocab-tools/src/schema.yaml index 4a059512f..f550d2fdc 100644 --- a/packages/vocab-tools/src/schema.yaml +++ b/packages/vocab-tools/src/schema.yaml @@ -113,6 +113,33 @@ $defs: Whether the embedded context should be the same as the context of the enclosing document. const: true + preprocessors: + description: >- + Preprocessors for this property. Each preprocessor receives an + expanded JSON-LD property value and may return a vocabulary object + matching the property's declared range, `undefined` when it did not + handle the value, or an `Error` when it recognized the value but + failed while converting it. + + `module` is resolved from the generated vocabulary source file + and imported statically at the top of the generated file. + type: array + items: + type: object + properties: + module: + description: >- + Module specifier resolved from the generated vocabulary + source file. + type: string + minLength: 1 + function: + description: The name of the exported function in the module. + type: string + pattern: "^[a-zA-Z_$][a-zA-Z0-9_$]*$" + required: + - module + - function required: - singularName - uri diff --git a/packages/vocab/src/mod.ts b/packages/vocab/src/mod.ts index aca32146a..b928ecd80 100644 --- a/packages/vocab/src/mod.ts +++ b/packages/vocab/src/mod.ts @@ -53,6 +53,7 @@ export * from "./actor.ts"; export * from "./constants.ts"; export * from "./handle.ts"; export * from "./lookup.ts"; +export * from "./preprocessors.ts"; export * from "./type.ts"; export * from "./vocab.ts"; export { LanguageString } from "@fedify/vocab-runtime"; diff --git a/packages/vocab/src/object.yaml b/packages/vocab/src/object.yaml index 8b8487372..d9382b9c3 100644 --- a/packages/vocab/src/object.yaml +++ b/packages/vocab/src/object.yaml @@ -137,6 +137,9 @@ properties: (vertical) and should be suitable for presentation at a small size. range: - "https://www.w3.org/ns/activitystreams#Image" + preprocessors: + - module: ./preprocessors.ts + function: normalizeLinkToImage - pluralName: images singularName: image @@ -149,6 +152,9 @@ properties: limitations assumed. range: - "https://www.w3.org/ns/activitystreams#Image" + preprocessors: + - module: ./preprocessors.ts + function: normalizeLinkToImage - pluralName: replyTargets singularName: replyTarget diff --git a/packages/vocab/src/preprocessors.ts b/packages/vocab/src/preprocessors.ts new file mode 100644 index 000000000..be781fe1d --- /dev/null +++ b/packages/vocab/src/preprocessors.ts @@ -0,0 +1,48 @@ +import type { PropertyPreprocessor } from "@fedify/vocab-runtime"; +import { Image, Link } from "./vocab.ts"; + +/** + * A property preprocessor that normalizes Link values to Image objects. + * + * When an `icon` or `image` property on a vocabulary object contains an + * explicit ActivityStreams `Link` rather than an `Image`, this preprocessor + * converts it into an `Image` by mapping `href` to `url`, copying + * `mediaType`, `name`, `width`, and `height`, and discarding the rest. + * + * If the value is not a Link, or the Link has no `href`, it returns + * `undefined` so the normal range decoder continues. + * @since 2.3.0 + */ +export const normalizeLinkToImage: PropertyPreprocessor = async ( + value, + context, +) => { + if ( + typeof value !== "object" || + value === null || + Array.isArray(value) || + !("@type" in value) || + !Array.isArray(value["@type"]) || + !value["@type"].includes("https://www.w3.org/ns/activitystreams#Link") + ) { + return undefined; + } + + let link: Link; + try { + link = await Link.fromJsonLd(value, context); + } catch (error) { + return error instanceof Error ? error : new Error(String(error)); + } + + if (link.href == null) return undefined; + + return new Image({ + id: link.id, + url: link.href, + mediaType: link.mediaType, + names: link.names != null && link.names.length > 0 ? link.names : undefined, + width: link.width, + height: link.height, + }); +}; diff --git a/packages/vocab/src/vocab.test.ts b/packages/vocab/src/vocab.test.ts index 84284544b..f97e9b32c 100644 --- a/packages/vocab/src/vocab.test.ts +++ b/packages/vocab/src/vocab.test.ts @@ -1844,6 +1844,327 @@ test("Person.fromJsonLd() with relative URLs and baseUrl", async () => { ); }); +test("Object.fromJsonLd() normalizes Link icon to Image", async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "content": "Hello", + "icon": { + "type": "Link", + "href": "https://example.com/icon.png", + "mediaType": "image/png", + "name": "Icon", + "width": 64, + "height": 64, + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + }); + const icon = await obj.getIcon(); + deepStrictEqual( + icon?.url?.href, + "https://example.com/icon.png", + ); + deepStrictEqual(icon?.mediaType, "image/png"); + deepStrictEqual(icon?.names, ["Icon"]); + deepStrictEqual(icon?.width, 64); + deepStrictEqual(icon?.height, 64); +}); + +test("Object.fromJsonLd() normalizes Link image to Image", async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "content": "Hello", + "image": { + "type": "Link", + "href": "https://example.com/banner.png", + "mediaType": "image/png", + "width": 800, + "height": 200, + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + }); + const images = []; + for await (const img of obj.getImages()) { + images.push(img); + } + deepStrictEqual(images[0]?.url?.href, "https://example.com/banner.png"); + deepStrictEqual(images[0]?.mediaType, "image/png"); + deepStrictEqual(images[0]?.width, 800); + deepStrictEqual(images[0]?.height, 200); +}); + +test("Object.fromJsonLd() normalizes Link icon with relative URL", async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "id": "https://example.com/notes/1", + "content": "Hello", + "icon": { + "type": "Link", + "href": "/icons/icon.png", + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + }); + const icon = await obj.getIcon(); + deepStrictEqual( + icon?.url?.href, + "https://example.com/icons/icon.png", + ); +}); + +test( + "Object.fromJsonLd() normalizes Link icon with relative id and baseUrl", + async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "id": "/notes/1", + "content": "Hello", + "icon": { + "type": "Link", + "href": "/icons/icon.png", + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + baseUrl: new URL("https://example.com/"), + }); + const icon = await obj.getIcon(); + deepStrictEqual(obj.id?.href, "https://example.com/notes/1"); + deepStrictEqual( + icon?.url?.href, + "https://example.com/icons/icon.png", + ); + }, +); + +test("Object.fromJsonLd() decodes Image icon with relative id and baseUrl", async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "id": "/notes/1", + "content": "Hello", + "icon": { + "type": "Image", + "url": "/icons/icon.png", + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + baseUrl: new URL("https://example.com/"), + }); + const icon = await obj.getIcon(); + deepStrictEqual(obj.id?.href, "https://example.com/notes/1"); + deepStrictEqual( + icon?.url?.href, + "https://example.com/icons/icon.png", + ); +}); + +test( + "Object.getIcon() resolves relative Link href without id via cached re-parse", + async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "content": "Hello", + "icon": { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Link", + "href": "/icons/star.png", + "mediaType": "image/png", + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + baseUrl: new URL("https://example.com/"), + }); + // getIcon() is called WITHOUT explicit baseUrl — the accessor + // should reuse the baseUrl that was set during fromJsonLd(). + const icon = await obj.getIcon(); + deepStrictEqual( + icon?.url?.href, + "https://example.com/icons/star.png", + ); + deepStrictEqual(icon?.mediaType, "image/png"); + }, +); + +test( + "Object.getIcon() ignores mutation of caller's baseUrl after fromJsonLd()", + async () => { + const origBaseUrl = new URL("https://example.com/"); + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "content": "Hello", + "icon": { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Link", + "href": "/icons/star.png", + "mediaType": "image/png", + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + baseUrl: origBaseUrl, + }); + // Mutate the caller's URL after construction. + origBaseUrl.href = "https://attacker.example/"; + const icon = await obj.getIcon(); + deepStrictEqual( + icon?.url?.href, + "https://example.com/icons/star.png", + ); + deepStrictEqual(icon?.mediaType, "image/png"); + }, +); + +test( + "Object.fromJsonLd() does not resolve blank node @id against baseUrl", + async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "id": "_:b0", + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + baseUrl: new URL("https://example.com/"), + }); + // Blank node identifiers must not be resolved against baseUrl. + deepStrictEqual(obj.id, null); + }, +); + +test( + "Object.fromJsonLd() handles blank node @id without baseUrl", + () => { + const obj = Object.fromJsonLd({ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "id": "_:b0", + }, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + }); + // Blank node identifier without baseUrl must not throw. + return obj.then((o) => deepStrictEqual(o.id, null)); + }, +); + +test( + "Object.getAttachments() resolves relative url via stored _baseUrl", + async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "content": "Hello", + "attachment": { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Document", + "url": "/files/report.pdf", + "mediaType": "application/pdf", + }, + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + baseUrl: new URL("https://example.com/"), + }); + // getAttachments() without explicit baseUrl should use stored _baseUrl. + const attachments = []; + for await (const a of obj.getAttachments()) { + attachments.push(a); + } + deepStrictEqual(attachments.length, 1); + // deno-lint-ignore no-explicit-any + const doc = attachments[0] as any; + deepStrictEqual( + doc?.url?.href, + "https://example.com/files/report.pdf", + ); + deepStrictEqual(doc?.mediaType, "application/pdf"); + }, +); + +test("Object.fromJsonLd() normalizes multiple Link icons", async () => { + const json = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "content": "Hello", + "icon": [ + { "type": "Link", "href": "https://example.com/a.png" }, + { "type": "Image", "url": "https://example.com/b.png" }, + ], + }; + const obj = await Object.fromJsonLd(json, { + documentLoader: mockDocumentLoader, + contextLoader: mockDocumentLoader, + }); + const icons = []; + for await (const i of obj.getIcons()) { + icons.push(i); + } + deepStrictEqual(icons.length, 2); + deepStrictEqual(icons[0]?.url?.href, "https://example.com/a.png"); + deepStrictEqual(icons[1]?.url?.href, "https://example.com/b.png"); +}); + +test("Object.getIcon() normalizes fetched Link document to Image", async () => { + const linkDocUrl = "https://example.com/icons/avatar-link"; + const linkDoc = { + "@context": "https://www.w3.org/ns/activitystreams", + type: "Link", + href: "https://example.com/avatars/user.png", + mediaType: "image/png", + width: 128, + height: 128, + }; + const docLoader = async (url: string) => { + if (url === linkDocUrl) { + return { + document: linkDoc, + documentUrl: url, + contextUrl: null, + }; + } + return await mockDocumentLoader(url); + }; + + const person = new Person({ + id: new URL("https://example.com/ap/actors/test-user"), + icon: new URL(linkDocUrl), + }); + + const icon = await person.getIcon({ + documentLoader: docLoader, + contextLoader: mockDocumentLoader, + }); + deepStrictEqual( + icon?.url?.href, + "https://example.com/avatars/user.png", + ); + deepStrictEqual(icon?.mediaType, "image/png"); + deepStrictEqual(icon?.width, 128); + deepStrictEqual(icon?.height, 128); +}); + test("FEP-fe34: Trust tracking in object construction", async () => { // Test that objects created with embedded objects have trust set const note = new Note({