diff --git a/.agents/skills/add-vocab/SKILL.md b/.agents/skills/add-vocab/SKILL.md index 863a2a043..14aa2ad63 100644 --- a/.agents/skills/add-vocab/SKILL.md +++ b/.agents/skills/add-vocab/SKILL.md @@ -63,6 +63,12 @@ The `@fedify/vocab-tools` snapshots are stored separately for Deno, Node.js, and Bun. Always update all three with the aggregate task when generated output changes; do not update only one runtime's snapshot. +Adding a property also changes what `getRawPropertyValues()` returns for its +IRI and for its `redundantProperties` aliases: they stop being retained as +unsupported properties and are encoded from the typed values instead. Mention +this in the changelog entry when applications may already be reading the +property through that function. + YAML file format ---------------- diff --git a/CHANGES.md b/CHANGES.md index 30b7b14fd..7fa757a2a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -277,6 +277,15 @@ To be released. plugin rules as errors, so projects generated by `fedify init` exclude the selected rule while keeping the deprecated option usable. [[#1335], [#1340]] + - Added the `raw-property-iri-invalid` rule, which reports property IRIs + passed to `getRawPropertyValues()` and `getRawPropertyValue()` that throw + at runtime, such as terms and JSON-LD keywords, and compact IRIs such as + `as:content`, which are looked up literally. With ESLint and Oxlint, the + `modules` option adds other vocabulary modules generated by + `@fedify/vocab-tools` to the default `@fedify/vocab`. [[#1272], [#1356]] + +[#1272]: https://github.com/fedify-dev/fedify/issues/1272 +[#1356]: https://github.com/fedify-dev/fedify/pull/1356 ### @fedify/postgres @@ -310,6 +319,17 @@ To be released. entries may not be visited. Accessor and serialization traversal costs are unchanged. [[#1243], [#1337]] + - Added `getRawPropertyValues()` and `getRawPropertyValue()` functions, + which read a property of a vocabulary object by its full IRI and return + its values in expanded JSON-LD. They let applications read properties + that Fedify has no accessor for, such as an extension used by only a few + peers, without depending on the JSON-LD serialization cache: unknown + properties are now retained when an object is decoded, including embedded + objects, and survive `clone()` and `deepClone()`. For properties Fedify + does support, the functions return the current typed values encoded back + into JSON-LD. The values are not verified, so validate them before use. + [[#1272], [#1356]] + - Added the `attributionDomains` property to `Application`, `Group`, `Organization`, `Person`, and `Service`, so applications can publish the domains an actor claims for Mastodon's `fediverse:creator` link credits @@ -338,6 +358,18 @@ To be released. - Fedify does not fill in a default license for objects without license metadata and never fetches a license URI. + - Fixed accessors of objects decoded by `fromJsonLd()` returning wrong + values for embedded objects that have their own `@context`. Such an + object was decoded again from its cached JSON-LD without the enclosing + document's context, so a type or property term that only the enclosing + context defined could yield an object of another class or drop + property values. It could also pick embedded objects under a term that + the enclosing context mapped to another property. The accessors now + return the object decoded with the whole document, which keeps the JSON-LD + it was received as for `toJsonLd()`. As a result, they return the same + object on each call, and an embedded object no longer takes the document + loaders passed to the accessor. [[#1272], [#1356]] + [FEP-6757]: https://w3id.org/fep/6757 [#1212]: https://github.com/fedify-dev/fedify/issues/1212 [#1241]: https://github.com/fedify-dev/fedify/pull/1241 @@ -355,6 +387,11 @@ To be released. e.g., `zh-YUE` with `yue`. `Intl.Locale` rejects extlang tags, so applications can normalize such tags before passing them to it. [[#1229], [#1231]] + - Added the `VocabularyObject` interface, which every class generated by + `@fedify/vocab-tools` implements, and the `RawPropertyValue` type with its + `RawValueObject`, `RawNodeObject`, and `RawListObject` shapes for the + expanded JSON-LD values that `getRawPropertyValues()` returns. + [[#1272], [#1356]] [#1229]: https://github.com/fedify-dev/fedify/issues/1229 [#1231]: https://github.com/fedify-dev/fedify/pull/1231 @@ -382,6 +419,18 @@ To be released. `https://w3id.org/identity/v1`. Previously, such a property compacted to a prefixed name like `dc:license` without the extra context. [[#1212], [#1241]] + - Fixed generated accessors decoding embedded objects that have their own + `@context` again without the enclosing document's context, which could + return objects of another class, drop property values, or pick objects + under a term the enclosing context mapped to another property. They now + return the objects decoded with the whole document. [[#1272], [#1356]] + - Generated vocabulary modules now export `getRawPropertyValues()` and + `getRawPropertyValue()`, which read any property of a generated object + by its full IRI, and their root classes implement `VocabularyObject` from + `@fedify/vocab-runtime`. Decoding retains the properties a class does not + know, so third-party vocabulary modules get the same access to + unsupported properties as `@fedify/vocab`. The functions accept objects + from any generated module. [[#1272], [#1356]] - Made the generated `xsd:string` decoder skip JSON-LD values whose `@value` is not a string instead of placing them in string accessors. Malformed remote values no longer leak numbers or booleans into properties such as diff --git a/changes.d/lint/raw-property-iri-invalid.md b/changes.d/lint/raw-property-iri-invalid.md new file mode 100644 index 000000000..de7081682 --- /dev/null +++ b/changes.d/lint/raw-property-iri-invalid.md @@ -0,0 +1,11 @@ +--- +links: + '#1272': https://github.com/fedify-dev/fedify/issues/1272 + '#1356': https://github.com/fedify-dev/fedify/pull/1356 +--- + - Added the `raw-property-iri-invalid` rule, which reports property IRIs + passed to `getRawPropertyValues()` and `getRawPropertyValue()` that throw + at runtime, such as terms and JSON-LD keywords, and compact IRIs such as + `as:content`, which are looked up literally. With ESLint and Oxlint, the + `modules` option adds other vocabulary modules generated by + `@fedify/vocab-tools` to the default `@fedify/vocab`. [[#1272], [#1356]] diff --git a/changes.d/vocab-runtime/vocabulary-object.md b/changes.d/vocab-runtime/vocabulary-object.md new file mode 100644 index 000000000..87254be42 --- /dev/null +++ b/changes.d/vocab-runtime/vocabulary-object.md @@ -0,0 +1,10 @@ +--- +links: + '#1272': https://github.com/fedify-dev/fedify/issues/1272 + '#1356': https://github.com/fedify-dev/fedify/pull/1356 +--- + - Added the `VocabularyObject` interface, which every class generated by + `@fedify/vocab-tools` implements, and the `RawPropertyValue` type with its + `RawValueObject`, `RawNodeObject`, and `RawListObject` shapes for the + expanded JSON-LD values that `getRawPropertyValues()` returns. + [[#1272], [#1356]] diff --git a/changes.d/vocab-tools/embedded-object-context.md b/changes.d/vocab-tools/embedded-object-context.md new file mode 100644 index 000000000..17dede6cb --- /dev/null +++ b/changes.d/vocab-tools/embedded-object-context.md @@ -0,0 +1,10 @@ +--- +links: + '#1272': https://github.com/fedify-dev/fedify/issues/1272 + '#1356': https://github.com/fedify-dev/fedify/pull/1356 +--- + - Fixed generated accessors decoding embedded objects that have their own + `@context` again without the enclosing document's context, which could + return objects of another class, drop property values, or pick objects + under a term the enclosing context mapped to another property. They now + return the objects decoded with the whole document. [[#1272], [#1356]] diff --git a/changes.d/vocab-tools/raw-property-values.md b/changes.d/vocab-tools/raw-property-values.md new file mode 100644 index 000000000..f444ea68b --- /dev/null +++ b/changes.d/vocab-tools/raw-property-values.md @@ -0,0 +1,12 @@ +--- +links: + '#1272': https://github.com/fedify-dev/fedify/issues/1272 + '#1356': https://github.com/fedify-dev/fedify/pull/1356 +--- + - Generated vocabulary modules now export `getRawPropertyValues()` and + `getRawPropertyValue()`, which read any property of a generated object + by its full IRI, and their root classes implement `VocabularyObject` from + `@fedify/vocab-runtime`. Decoding retains the properties a class does not + know, so third-party vocabulary modules get the same access to + unsupported properties as `@fedify/vocab`. The functions accept objects + from any generated module. [[#1272], [#1356]] diff --git a/changes.d/vocab/embedded-object-context.md b/changes.d/vocab/embedded-object-context.md new file mode 100644 index 000000000..24b965355 --- /dev/null +++ b/changes.d/vocab/embedded-object-context.md @@ -0,0 +1,16 @@ +--- +links: + '#1272': https://github.com/fedify-dev/fedify/issues/1272 + '#1356': https://github.com/fedify-dev/fedify/pull/1356 +--- + - Fixed accessors of objects decoded by `fromJsonLd()` returning wrong + values for embedded objects that have their own `@context`. Such an + object was decoded again from its cached JSON-LD without the enclosing + document's context, so a type or property term that only the enclosing + context defined could yield an object of another class or drop + property values. It could also pick embedded objects under a term that + the enclosing context mapped to another property. The accessors now + return the object decoded with the whole document, which keeps the JSON-LD + it was received as for `toJsonLd()`. As a result, they return the same + object on each call, and an embedded object no longer takes the document + loaders passed to the accessor. [[#1272], [#1356]] diff --git a/changes.d/vocab/raw-property-values.md b/changes.d/vocab/raw-property-values.md new file mode 100644 index 000000000..e0a32300a --- /dev/null +++ b/changes.d/vocab/raw-property-values.md @@ -0,0 +1,15 @@ +--- +links: + '#1272': https://github.com/fedify-dev/fedify/issues/1272 + '#1356': https://github.com/fedify-dev/fedify/pull/1356 +--- + - Added `getRawPropertyValues()` and `getRawPropertyValue()` functions, + which read a property of a vocabulary object by its full IRI and return + its values in expanded JSON-LD. They let applications read properties + that Fedify has no accessor for, such as an extension used by only a few + peers, without depending on the JSON-LD serialization cache: unknown + properties are now retained when an object is decoded, including embedded + objects, and survive `clone()` and `deepClone()`. For properties Fedify + does support, the functions return the current typed values encoded back + into JSON-LD. The values are not verified, so validate them before use. + [[#1272], [#1356]] diff --git a/claude-plugin/skills/fedify/SKILL.md b/claude-plugin/skills/fedify/SKILL.md index c6385e05b..e965ca0eb 100644 --- a/claude-plugin/skills/fedify/SKILL.md +++ b/claude-plugin/skills/fedify/SKILL.md @@ -277,6 +277,16 @@ overrides: `deepClone()` snapshots the existing indices of large sparse arrays. Entries added during copying are not visited, so their nested objects may remain shared. Copying preserves array length and holes. +To read a property that has no typed accessor, such as an application's +extension, use `getRawPropertyValues(object, propertyIri)` or +`getRawPropertyValue()` from `@fedify/vocab` (Fedify 2.5.0 and later) instead +of digging through `toJsonLd()` output. Pass the full property IRI, never a +compact IRI like `as:content` or a term; prefixes are not expanded. The +results are untyped expanded JSON-LD values, unverified like any received +data, so validate them before use. For properties Fedify does support, the +functions return the current typed values encoded back, not the received +document. + > [!WARNING] > `crossOrigin: "trust"` on vocabulary deserialization trusts embedded > objects without re-fetching. Treat it as you would diff --git a/docs/manual/lint.md b/docs/manual/lint.md index 149c1573e..867915104 100644 --- a/docs/manual/lint.md +++ b/docs/manual/lint.md @@ -1782,6 +1782,84 @@ federation.setFollowersDispatcher( [*Filtering by server*]: ./collections.md#filtering-by-server +### `raw-property-iri-invalid` + +Warns when statically known property IRIs passed to `getRawPropertyValues()` +or `getRawPropertyValue()` are invalid or use a scheme other than +`http:`/`https:`. Named imports, aliases, and namespace imports are +supported; shadowed local bindings are ignored. See [*Reading unsupported +properties*](./vocab.md#reading-unsupported-properties) for these functions. + +Raw-property helpers require full IRIs. Empty strings, JSON-LD keywords, +blank node identifiers, bare terms, relative references, and other invalid +IRI strings throw `TypeError` at runtime. IRIs with other schemes are +accepted at runtime but both log a warning and trigger this rule: compact +IRIs such as `as:content` are looked up literally, and prefixes are never +expanded. For well-known prefixes, the report includes the full IRI, which +ESLint also offers as an editor suggestion. + +~~~~ typescript +import { getRawPropertyValues } from "@fedify/vocab"; + +// Reported: a bare term throws TypeError. +await getRawPropertyValues(note, "content"); + +// Reported: a compact IRI is looked up literally. +await getRawPropertyValues(note, "as:content"); + +// Use the full property IRI. +await getRawPropertyValues(note, "https://www.w3.org/ns/activitystreams#content"); +~~~~ + +The rule checks string literals, templates without expressions, `const` +bindings to those, and global `new URL("…")` calls without a base argument. +Dynamic values, `new URL(relative, base)`, and `URL` objects bound to +a variable are ignored, since a `URL` object can be changed after it is +constructed. Inside a TypeScript namespace or enum, `const` bindings declared +outside of it are ignored too, since another declaration of the same namespace +or enum can shadow them. + +By default, only imports from `@fedify/vocab` are inspected, including +`jsr:`/`npm:` and versioned specifiers. The deprecated +`@fedify/fedify/vocab` re-export is also inspected. For other vocabulary +modules generated with `@fedify/vocab-tools`, add their exact import +specifiers to `modules`. +The option adds to the defaults. List each custom specifier form you use, +such as both `@example/vocab` and `npm:@example/vocab`. + +~~~~ typescript +// eslint.config.ts +import { plugin } from "@fedify/lint"; + +export default [{ + plugins: { "@fedify/lint": plugin }, + rules: { + "@fedify/lint/raw-property-iri-invalid": ["warn", { + modules: ["@example/vocab"], + }], + }, +}]; +~~~~ + +Oxlint 1.31.0 or later is required to pass rule options: + +~~~~ jsonc +// .oxlintrc.json +{ + "jsPlugins": ["@fedify/lint/oxlint"], + "rules": { + "@fedify/lint/raw-property-iri-invalid": ["warn", { + "modules": ["@example/vocab"] + }] + } +} +~~~~ + +Deno Lint plugin rules cannot receive options, so this rule inspects only +the default `@fedify/vocab` module specifiers there. Like other Deno Lint +plugin rules, its reports are errors. ESLint's recommended configuration +enables it as a warning; the strict configuration enables it as an error. + ### `deno-kv-store-deprecated` Warns when `DenoKvStore` from the deprecated *@fedify/denokv* package is diff --git a/docs/manual/vocab.md b/docs/manual/vocab.md index b244425c1..47b147971 100644 --- a/docs/manual/vocab.md +++ b/docs/manual/vocab.md @@ -946,10 +946,7 @@ The `clone()` method accepts the same property values as the constructor. It makes a *shallow copy*: the clone has its own property arrays, but nested objects and URLs are shared with the source. Hydrating a shared nested object through either instance changes that nested object for both when their accessors -return the shared instance. A parsed source can return a fresh object instead: -if its cached JSON-LD contains an embedded object with its own `@context`, the -accessor re-parses that object on each call. Hydrating that returned object -does not update the nested instance stored in the source or clone. +return the shared instance. ### Deep copies @@ -1348,9 +1345,165 @@ to determine whether property accessors need to perform additional validation or fetching. +Reading unsupported properties +------------------------------ + +*This API is available since Fedify 2.5.0.* + +Peers sometimes send properties that Fedify has no accessor for, such as an +extension that only a few implementations understand. The +`getRawPropertyValues()` function reads such a property by its full IRI and +returns its values in [expanded JSON-LD][]: + +~~~~ typescript twoslash +import { getRawPropertyValues, Note } from "@fedify/vocab"; + +const note = await Note.fromJsonLd({ + "@context": [ + "https://www.w3.org/ns/activitystreams", + { "quant": "https://w3id.org/quantpub#" }, + ], + "type": "Note", + "content": "My morning run", + "quant:structuredUrl": { "id": "https://example.com/runs/1?token=abc" }, +}); + +const values = await getRawPropertyValues( + note, + "https://w3id.org/quantpub#structuredUrl", +); +// [{ "@id": "https://example.com/runs/1?token=abc" }] +~~~~ + +The lookup goes through JSON-LD expansion, so it does not matter which prefix +or term the sender used for the property; `"q:structuredUrl"` under +a `"q"` prefix for the same namespace gives the same result. A property that +the object does not have gives an empty array. + +The `getRawPropertyValue()` function returns only the first value, or `null` +if there is none. It does not throw when there are more values: JSON-LD does +not order the values of a property unless it is a list, so the first value is +not more significant than the others. + +~~~~ typescript twoslash +import { getRawPropertyValue, Note } from "@fedify/vocab"; +const note = new Note({}); +// ---cut-before--- +const value = await getRawPropertyValue( + note, + "https://w3id.org/quantpub#structuredUrl", +); +if (value != null && "@id" in value && typeof value["@id"] === "string") { + const url = new URL(value["@id"]); +} +~~~~ + +Both functions accept a `URL` as well as a string, and work for the objects of +any vocabulary module generated by `@fedify/vocab-tools`. Their parameter type +is `VocabularyObject`, an interface that all generated classes implement. + +[expanded JSON-LD]: https://www.w3.org/TR/json-ld11/#expanded-document-form + +### Value shapes + +The values are untyped, which is what *raw* refers to in the function names. +Each value takes one of the following shapes, which the `RawPropertyValue` +type describes. Narrow it with the `in` operator. + +Value object +: A literal, such as `{ "@value": "Hello" }`, + `{ "@value": "Bonjour", "@language": "fr" }`, or + `{ "@value": "2024-01-01T00:00:00Z", "@type": "http://www.w3.org/2001/XMLSchema#dateTime" }`. + A JSON literal has `"@type": "@json"`, and its `@value` is the JSON value + itself. + +Node object +: A reference, such as `{ "@id": "https://example.com/" }`, or an embedded + node, whose `@type` is an array of type IRIs and whose other keys are full + property IRIs with arrays of values. + +List object +: The single value of a property whose values are ordered, such as + `{ "@list": [{ "@value": 1 }, { "@value": 2 }] }`. + +The result is a deep copy, so changing it does not affect the object. + +### Supported and unsupported properties + +The functions accept the IRIs of properties that Fedify does support, too, +but they get the values differently: + + - For a property that the object's class has no accessor for, the values + are the ones retained when the object was decoded by `fromJsonLd()`. + Objects constructed locally have none. The retained values are shared + with copies made by `clone()` and `deepClone()`, even when the copy + replaces other values. Relative references in them are not resolved + against the document's base, because Fedify cannot tell which of an + unknown property's values are meant to be IRIs; resolve them yourself if + the property calls for it. + - For a property that the object's class has an accessor for, including an + alternative IRI that Fedify reads for the same property, the values are + the current typed values encoded back into expanded JSON-LD. + +The second case is not a round trip of the received document. Values that +failed to decode are missing, date-times and other lexical forms are +normalized, relative IRIs are resolved, `@direction` is lost, and values given +under an alternative IRI are returned for the canonical one as well. The +values also reflect what happened to the object after it was decoded: +replacements made by `clone()`, and objects that [property hydration] fetched +and cached in place of embedded ones. Encoding a property whose values are +nested objects does not include the unknown properties of those nested +objects; read them from the nested objects themselves. + +Whether a property is supported depends on the class of the object, not on +the vocabulary as a whole. A `Person` has no accessor for `Question`'s +`oneOf`, so `oneOf` on a `Person` is retained as an unsupported property. +When a later Fedify release adds an accessor for a property you read this +way, the same call keeps working, but it returns encoded values from then on. + +[property hydration]: #property-hydration + +### Property IRIs + +The property IRI has to be absolute. An empty string, a JSON-LD keyword such +as `"@id"`, a blank node identifier, a term such as `"content"`, and a relative +reference make the functions throw a `TypeError`. Prefixes are never expanded: +`"as:content"` is a valid IRI with the `as:` scheme, so it is looked up +literally and normally matches nothing. Since that is almost always a +mistake, an IRI with a scheme other than `http:` or `https:` is logged as +a warning under the `["fedify", "vocab"]` category, with a suggestion when the +prefix is a well-known one. The [`raw-property-iri-invalid`] lint rule +reports these mistakes before the code runs. + +The IRI is matched as it is first, and then as normalized by the [WHATWG URL] +parser, so `"HTTPS://W3ID.org/quantpub#structuredUrl"` finds the same property +as its lowercase form. + +[`raw-property-iri-invalid`]: ./lint.md#raw-property-iri-invalid +[WHATWG URL]: https://url.spec.whatwg.org/ + +### Security considerations + +The values are what the sender put in the document. They are not covered by +the [origin-based security model](#origin-based-security-model), the trust +tracking of property accessors, or the verification of +[FEP-ef61 portable objects](#fep-ef61-portable-objects). IRIs in them are +never dereferenced. Validate the values before you use them, and remember +that an embedded node may claim any `@id`. + +Retained values stay in memory as long as the object does. If a property +carries a secret, such as a capability token, avoid logging the values. + +*[IRI]: Internationalized Resource Identifier + + Extending the vocabulary ------------------------ +To read a property that Fedify does not support, you do not need to extend +the vocabulary: see [*Reading unsupported +properties*](#reading-unsupported-properties). + While Fedify's vocabulary API offers many advantages, it has a limitation due to its implementation through code generation: it is difficult to extend with custom types or custom properties that are not included in the Activity diff --git a/packages/astro/compat/run.ts b/packages/astro/compat/run.ts index b25389a09..b60f19026 100644 --- a/packages/astro/compat/run.ts +++ b/packages/astro/compat/run.ts @@ -101,9 +101,10 @@ async function testCompatibility(testCase: CompatibilityCase): Promise { pnpm: { overrides: { ...Object.fromEntries(tarballs), - // Version 1.2.0 requires @emnapi/* 2.0 prereleases, while its - // consumers still provide @emnapi/* 1.x. - "@napi-rs/wasm-runtime@^1.1.6": "1.1.6", + // Consumers provide either @emnapi/* 1.x or 2.0 prereleases, and + // versions in between accept only one of them, while this one + // accepts both. + "@napi-rs/wasm-runtime@^1.1.6": "1.2.7", }, }, }, diff --git a/packages/lint/README.md b/packages/lint/README.md index c139718f7..e90df5933 100644 --- a/packages/lint/README.md +++ b/packages/lint/README.md @@ -21,6 +21,7 @@ The plugin includes rules that check for: - Correct URL patterns for actor collections - Public key and assertion method requirements - Collection filtering implementation + - Full property IRIs for raw-property helpers (`raw-property-iri-invalid`) [JSR badge]: https://jsr.io/badges/@fedify/lint [JSR]: https://jsr.io/@fedify/lint @@ -145,6 +146,11 @@ gateway-compatible IDs. - **`outbox-listener-delivery-not-awaited`**: Warns when an outbox listener calls `sendActivity` or `forwardActivity` and does not wait for the result (ESLint and Oxlint only) + - **`raw-property-iri-invalid`**: Warns when a property IRI passed to + `getRawPropertyValues()` or `getRawPropertyValue()` is not a full + `http:` or `https:` IRI, e.g., a term or a compact IRI like `as:content`; + the `modules` option, available in ESLint and Oxlint only, adds other + generated vocabulary modules to `@fedify/vocab` ### Deprecation rules diff --git a/packages/lint/src/index.ts b/packages/lint/src/index.ts index 82c146ae5..cb4bc3eec 100644 --- a/packages/lint/src/index.ts +++ b/packages/lint/src/index.ts @@ -95,10 +95,13 @@ import { eslint as outboxListenerDeliveryRequired, } from "./rules/outbox-listener-delivery-required.ts"; +import { eslint as rawPropertyIriInvalid } from "./rules/raw-property-iri-invalid.ts"; + const rules: Record< typeof RULE_IDS[keyof typeof RULE_IDS], Rule.RuleModule > = { + [RULE_IDS.rawPropertyIriInvalid]: rawPropertyIriInvalid, [RULE_IDS.actorIdMismatch]: actorIdMismatch, [RULE_IDS.actorIdRequired]: actorIdRequired, [RULE_IDS.actorFollowingPropertyRequired]: actorFollowingPropertyRequired, diff --git a/packages/lint/src/lib/const.ts b/packages/lint/src/lib/const.ts index a077ad105..2fc3d0c27 100644 --- a/packages/lint/src/lib/const.ts +++ b/packages/lint/src/lib/const.ts @@ -185,6 +185,8 @@ export const RULE_IDS = { mediaUploaderObjectUriRequired: "media-uploader-object-uri-required", mediaUploaderAuthorizationRequired: "media-uploader-authorization-required", + rawPropertyIriInvalid: "raw-property-iri-invalid", + // Deprecation rules denoKvStoreDeprecated: "deno-kv-store-deprecated", denoKvMessageQueueDeprecated: "deno-kv-message-queue-deprecated", diff --git a/packages/lint/src/lib/messages.ts b/packages/lint/src/lib/messages.ts index 8d806ab95..dc2c14048 100644 --- a/packages/lint/src/lib/messages.ts +++ b/packages/lint/src/lib/messages.ts @@ -88,3 +88,12 @@ export const DENO_KV_MESSAGE_QUEUE_DEPRECATED = "`PostgresMessageQueue`, `RedisMessageQueue`, `MysqlMessageQueue`, " + "`AmqpMessageQueue`, or `WorkersMessageQueue` for production. See " + "https://github.com/fedify-dev/fedify/issues/1336 for the removal plan."; + +/** Messages for invalid or likely abbreviated raw-property IRIs. */ +export const RAW_PROPERTY_IRI_MESSAGES = { + invalid: + 'Raw property IRI "{{value}}" must be a full, syntactically valid IRI; this value throws TypeError at runtime.', + nonHttp: + 'Raw property IRI "{{value}}" uses a non-HTTP scheme. Prefixes are not expanded.{{hint}}', + expandPrefix: 'Use the full IRI "{{replacement}}".', +}; diff --git a/packages/lint/src/lib/raw-property-iri.ts b/packages/lint/src/lib/raw-property-iri.ts new file mode 100644 index 000000000..b6e731f9e --- /dev/null +++ b/packages/lint/src/lib/raw-property-iri.ts @@ -0,0 +1,555 @@ +import type { Node } from "./types.ts"; + +/** Options for checking additional generated vocabulary modules. */ +export interface RawPropertyIriOptions { + modules?: readonly string[]; +} + +/** A statically known property IRI and its suggested expansion, if any. */ +export interface RawPropertyIriDiagnostic { + node: Node; + messageId: "invalid" | "nonHttp"; + value: string; + replacement?: string; + suggestionNode?: Node; +} + +// A structural view keeps the analysis independent of the three AST providers. +type Ast = { type: string; [key: string]: unknown }; +interface Binding { + imported?: string; + namespace?: boolean; + init?: Ast; +} +interface Scope { + parent?: Scope; + functionScope: boolean; + /** + * The names that declarations merged with this namespace or enum export. + * It is set on the scopes of those, and only of those. + */ + merged?: Set; + bindings: Map; +} + +const functions = new Set([ + "getRawPropertyValues", + "getRawPropertyValue", +]); +const prefixes: Readonly> = { + as: "https://www.w3.org/ns/activitystreams#", + dcterms: "http://purl.org/dc/terms/", + fedibird: "http://fedibird.com/ns#", + ldp: "http://www.w3.org/ns/ldp#", + litepub: "http://litepub.social/ns#", + misskey: "https://misskey-hub.net/ns#", + schema: "http://schema.org#", + sec: "https://w3id.org/security#", + toot: "http://joinmastodon.org/ns#", + vcard: "http://www.w3.org/2006/vcard/ns#", +}; + +function ast(value: unknown): Ast | undefined { + return value != null && typeof value === "object" && + typeof (value as Ast).type === "string" + ? value as Ast + : undefined; +} +function name(value: unknown): string | undefined { + const node = ast(value); + return node?.type === "Identifier" + ? node.name as string + : typeof node?.value === "string" + ? node.value + : undefined; +} +function children(node: Ast): Ast[] { + const result: Ast[] = []; + // Deno exposes AST fields through non-enumerable getters. Include its + // standard child fields explicitly, while retaining parser-specific fields + // from ESTree providers. Never follow parent pointers. + const keys = new Set([ + ...Object.keys(node), + "declaration", + "openingElement", + "closingElement", + "attributes", + "decorators", + "parameter", + "body", + "expression", + "expressions", + "declarations", + "id", + "init", + "params", + "param", + "callee", + "arguments", + "object", + "property", + "key", + "value", + "properties", + "elements", + "left", + "right", + "argument", + "test", + "consequent", + "alternate", + "block", + "handler", + "finalizer", + "cases", + "discriminant", + "update", + "specifiers", + "local", + "imported", + "source", + "superClass", + "tag", + "quasi", + "quasis", + "children", + "members", + "initializer", + ]); + for (const key of keys) { + // ESTree providers attach the token and comment arrays to Program: + if (key === "parent" || key === "tokens" || key === "comments") continue; + // typescript-eslint keeps a deprecated copy of TSEnumBody.members here: + if ( + key === "members" && node.type === "TSEnumDeclaration" && + ast(node.body) != null + ) { + continue; + } + const value = node[key]; + if (Array.isArray(value)) { + for (const item of value) { + const child = ast(item); + if (child) result.push(child); + } + } else { + const child = ast(value); + if (child) result.push(child); + } + } + return result; +} +function bind(pattern: unknown, scope: Scope, binding: Binding = {}): void { + const node = ast(pattern); + if (!node) return; + if (node.type === "Identifier") { + scope.bindings.set(node.name as string, binding); + } else if (node.type === "TSParameterProperty") { + bind(node.parameter, scope); + } else if (node.type === "RestElement") { + bind(node.argument, scope); + } else if (node.type === "AssignmentPattern") { + bind(node.left, scope); + } else if (node.type === "ObjectPattern") { + for (const property of node.properties as Ast[]) { + bind( + property.type === "RestElement" ? property.argument : property.value, + scope, + ); + } + } else if (node.type === "ArrayPattern") { + for (const element of node.elements as unknown[]) bind(element, scope); + } +} +/** + * Rewrites a single-quoted string literal's source as a double-quoted one, so + * that `JSON.parse()` can decode its escapes. Returns `null` for anything + * other than a string literal. + */ +function toJsonString(raw: string): string | null { + if (raw.startsWith('"')) return raw; + if (!raw.startsWith("'")) return null; + let result = '"'; + for (let i = 1; i < raw.length - 1; i++) { + const char = raw[i]; + if (char === "\\") { + const next = raw[++i]; + result += next === "'" ? "'" : char + next; + } else { + result += char === '"' ? '\\"' : char; + } + } + return result + '"'; +} + +const IP_LITERAL_PATTERN = /^\[([^\[\]]*)\](?::[0-9]*)?$/; +const IP_FUTURE_PATTERN = /^v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+$/i; + +/** + * Checks that an authority has a numeric port, if any, and that square + * brackets delimit an IPv6 address or an IPvFuture literal as the whole host, + * as the runtime does. + */ +function isAuthoritySyntax(authority: string): boolean { + const hostPort = authority.slice(authority.lastIndexOf("@") + 1); + const userinfo = authority.slice(0, authority.length - hostPort.length); + if (/[[\]]/.test(userinfo)) return false; + if (!/[[\]]/.test(hostPort)) return /^[^:]*(?::[0-9]*)?$/.test(hostPort); + const match = IP_LITERAL_PATTERN.exec(hostPort); + if (match == null) return false; + const literal = match[1]; + return IP_FUTURE_PATTERN.test(literal) || + URL.canParse(`http://[${literal}]/`); +} + +/** + * Whether a TypeScript namespace declares a value, as opposed to containing + * only types. Only such a namespace shadows an outer value binding. + */ +function isInstantiated(node: Ast): boolean { + const body = ast(node.body); + if (body == null) return true; + if (body.type === "TSModuleDeclaration") return isInstantiated(body); + for (const statement of (body.body ?? []) as Ast[]) { + const declaration = statement.type === "ExportNamedDeclaration" + ? ast(statement.declaration) + : statement; + if (declaration == null) continue; + if ( + // A non-exported import alias does not make a namespace a value: + (statement.type === "TSImportEqualsDeclaration" && + statement.isExport !== true) || + declaration.type === "TSInterfaceDeclaration" || + declaration.type === "TSTypeAliasDeclaration" || + (declaration.type === "TSModuleDeclaration" && + !isInstantiated(declaration)) + ) { + continue; + } + return true; + } + return false; +} + +function lookup( + scope: Scope | undefined, + identifier: string, +): Binding | undefined { + for (; scope; scope = scope.parent) { + if (scope.bindings.has(identifier)) return scope.bindings.get(identifier); + if (scope.merged?.has(identifier)) return {}; + } +} + +/** Lists the values that the body of a TypeScript namespace exports. */ +function exportedNames(block: Ast): string[] { + const scope: Scope = { functionScope: true, bindings: new Map() }; + for (const statement of (block.body ?? []) as Ast[]) { + const declaration = statement.type === "ExportNamedDeclaration" + ? ast(statement.declaration) + : statement.type === "TSImportEqualsDeclaration" && + statement.isExport === true + ? statement + : undefined; + if (declaration?.type === "VariableDeclaration") { + for (const variable of declaration.declarations as Ast[]) { + bind(variable.id, scope); + } + } else if ( + declaration != null && + declaration.type !== "TSInterfaceDeclaration" && + declaration.type !== "TSTypeAliasDeclaration" && + (declaration.type !== "TSModuleDeclaration" || + isInstantiated(declaration)) + ) { + bind(declaration.id, scope); + } + } + return [...scope.bindings.keys()]; +} + +/** + * Looks up a binding to follow for its value. Another declaration of the same + * namespace or enum can export a member that shadows an outer binding, so + * the lookup does not leave such a scope. + */ +function lookupConstant( + scope: Scope | undefined, + identifier: string, +): Binding | undefined { + for (; scope; scope = scope.parent) { + if (scope.bindings.has(identifier)) return scope.bindings.get(identifier); + if (scope.merged != null) return undefined; + } +} + +/** + * Analyze a complete program after collecting lexical bindings, including + * declarations that shadow imports before their textual declaration. + */ +export function checkRawPropertyIris( + program: Node, + options: RawPropertyIriOptions, + report: (diagnostic: RawPropertyIriDiagnostic) => void, +): void { + const scopes = new WeakMap(); + const calls: Ast[] = []; + const root: Scope = { functionScope: true, bindings: new Map() }; + // TypeScript merges namespaces and enums of the same name in a scope, and + // makes what each declaration exports visible in the others: + const members = new Map>>(); + const blockMembers = new WeakMap>(); + function mergedMembers(scope: Scope, id: string | undefined): Set { + if (id == null) return new Set(); + // Declarations nested in a merged namespace merge with each other, too: + const owner = scope.merged ?? scope; + let names = members.get(owner); + if (names == null) members.set(owner, names = new Map()); + let merged = names.get(id); + if (merged == null) names.set(id, merged = new Set()); + return merged; + } + function visit(node: Ast, outer: Scope): void { + if (node.type === "TSModuleDeclaration") { + const body = ast(node.body); + if (body?.type === "TSModuleBlock") { + const merged = mergedMembers(outer, name(node.id)); + blockMembers.set(body, merged); + for (const exported of exportedNames(body)) merged.add(exported); + } + } + const isFunction = + /^(?:FunctionDeclaration|FunctionExpression|ArrowFunctionExpression)$/ + .test(node.type); + if ( + node.type === "FunctionDeclaration" || + node.type === "ClassDeclaration" || + // Enums and namespaces with values also declare a value binding: + node.type === "TSEnumDeclaration" || + (node.type === "TSModuleDeclaration" && isInstantiated(node)) + ) { + bind(node.id, outer); + } + const scoped = isFunction || [ + "BlockStatement", + "CatchClause", + "ForStatement", + "ForInStatement", + "ForOfStatement", + "SwitchStatement", + "ClassExpression", + "ClassDeclaration", + "StaticBlock", + "TSModuleBlock", + "TSEnumDeclaration", + ].includes(node.type); + const scope: Scope = scoped + ? { + parent: outer, + // A TypeScript namespace body is compiled to a function body: + functionScope: isFunction || node.type === "StaticBlock" || + node.type === "TSModuleBlock", + merged: node.type === "TSModuleBlock" + ? blockMembers.get(node) ?? new Set() + : node.type === "TSEnumDeclaration" + ? mergedMembers(outer, name(node.id)) + : undefined, + bindings: new Map(), + } + : outer; + scopes.set(node, scope); + if (isFunction) { + if (node.type === "FunctionExpression") bind(node.id, scope); + for (const param of node.params as unknown[]) bind(param, scope); + } + if (node.type === "ClassExpression" || node.type === "ClassDeclaration") { + bind(node.id, scope); + } + if (node.type === "CatchClause") bind(node.param, scope); + // An import alias, such as import iri = M.iri, binds a value that is + // not statically known here: + if (node.type === "TSImportEqualsDeclaration") bind(node.id, scope); + if (node.type === "TSEnumDeclaration") { + // Initializers can refer to members by their bare names: + const body = ast(node.body); + const members = (body?.members ?? node.members ?? []) as Ast[]; + for (const member of members) { + const id = name(member.id); + if (id == null) continue; + scope.bindings.set(id, {}); + scope.merged?.add(id); + } + } + if (node.type === "ImportDeclaration") { + const source = name(node.source); + const included = source != null && ( + /^(?:jsr:|npm:)?@fedify\/vocab(?:@[^/]+)?$/.test(source) || + /^(?:jsr:|npm:)?@fedify\/fedify(?:@[^/]+)?\/vocab$/.test(source) || + options.modules?.includes(source) + ); + for (const specifier of node.specifiers as Ast[]) { + bind( + specifier.local, + scope, + included && node.importKind !== "type" && + specifier.importKind !== "type" + ? { + imported: name(specifier.imported), + namespace: specifier.type === "ImportNamespaceSpecifier", + } + : {}, + ); + } + } + if (node.type === "VariableDeclaration") { + let target = scope; + if (node.kind === "var") { + while (!target.functionScope && target.parent) target = target.parent; + } + for (const declaration of node.declarations as Ast[]) { + bind( + declaration.id, + target, + node.kind === "const" ? { init: ast(declaration.init) } : {}, + ); + } + } + if (node.type === "CallExpression") calls.push(node); + for (const child of children(node)) { + // The discriminant of a switch is evaluated outside its case scope: + visit( + child, + node.type === "SwitchStatement" && child === node.discriminant + ? outer + : scope, + ); + } + } + visit(program as unknown as Ast, root); + + function staticString( + node: Ast | undefined, + seen = new Set(), + bound = false, + ): { value: string; literal: Ast } | undefined { + if (!node || seen.has(node)) return; + seen.add(node); + if (node.type === "Literal" && typeof node.value === "string") { + // Deno replaces escaped lone surrogates in Literal.value with U+FFFD. + // JSON-compatible raw literals retain their exact code units. + const raw = typeof node.raw === "string" ? toJsonString(node.raw) : null; + if (raw != null) { + try { + const value: unknown = JSON.parse(raw); + if (typeof value === "string") return { value, literal: node }; + } catch { + // JavaScript-only escapes (such as \x20) use the parser's value. + } + } + return { value: node.value, literal: node }; + } + if ( + node.type === "TemplateLiteral" && + (node.expressions as unknown[]).length === 0 + ) { + const quasi = (node.quasis as Ast[])[0]; + const value = (quasi.value as { cooked?: string } | undefined)?.cooked ?? + quasi.cooked; + if (typeof value === "string") return { value, literal: node }; + } + if (node.type === "Identifier") { + return staticString( + lookupConstant(scopes.get(node), node.name as string)?.init, + seen, + true, + ); + } + if ( + // A URL object bound to a const can still be mutated, e.g., through its + // href setter, so only a URL constructed in place is known statically: + !bound && + node.type === "NewExpression" && name(node.callee) === "URL" && + ast(node.callee)?.type === "Identifier" && + !lookup(scopes.get(node), "URL") + ) { + const args = node.arguments as Ast[]; + if (args.length !== 1) return undefined; + const known = staticString(args[0], seen); + // The raw-property functions see the URL's serialization, which the + // WHATWG URL parser normalizes, e.g., by percent-encoding spaces: + if (known == null || !URL.canParse(known.value)) return known; + return { ...known, value: new URL(known.value).href }; + } + } + function check(node: Ast): void { + const known = staticString(node); + if (!known) return; + const value = known.value; + const scheme = /^([A-Za-z][A-Za-z0-9+.-]*):/.exec(value); + const rest = scheme == null ? "" : value.slice(scheme[0].length); + let path = rest; + let authority = ""; + if (rest.startsWith("//")) { + const end = rest.slice(2).search(/[/?#]/); + authority = end < 0 ? rest.slice(2) : rest.slice(2, 2 + end); + path = end < 0 ? "" : rest.slice(2 + end); + } + // These checks follow the raw-property API's IRI syntax contract, rather + // than WHATWG URL parsing (which normalizes spaces and malformed escapes). + if ( + !scheme || rest === "" || value.startsWith("_:") || + !isAuthoritySyntax(authority) || + path.includes("[") || path.includes("]") || + /["<>\\^`{|}]/u.test(value) || + Array.from(value).some((char) => { + const code = char.codePointAt(0)!; + return code <= 0x20 || (code >= 0x7f && code <= 0x9f) || + (code >= 0xd800 && code <= 0xdfff); + }) || + /%(?![\da-f]{2})/i.test(value) || + value.indexOf("#") !== value.lastIndexOf("#") + ) { + report({ node: node as unknown as Node, messageId: "invalid", value }); + } else if (!/^https?$/i.test(scheme[1])) { + const prefixName = scheme[1].toLowerCase(); + const prefix = Object.hasOwn(prefixes, prefixName) + ? prefixes[prefixName] + : undefined; + const replacement = prefix == null + ? undefined + : prefix + value.slice(scheme[0].length); + report({ + node: node as unknown as Node, + messageId: "nonHttp", + value, + replacement, + // Never suggest changing a const declaration shared by other uses. + suggestionNode: known.literal === node || + (node.type === "NewExpression" && + (node.arguments as unknown[])[0] === known.literal) + ? known.literal as unknown as Node + : undefined, + }); + } + } + for (const call of calls) { + const callee = ast(call.callee); + let functionName: string | undefined; + if (callee?.type === "Identifier") { + functionName = lookup(scopes.get(callee), callee.name as string) + ?.imported; + } else if ( + callee?.type === "MemberExpression" && + ast(callee.object)?.type === "Identifier" + ) { + if (lookup(scopes.get(callee), name(callee.object)!)?.namespace) { + functionName = callee.computed + ? staticString(ast(callee.property))?.value + : name(callee.property); + } + } + if (!functionName || !functions.has(functionName)) continue; + const argument = ast((call.arguments as unknown[])[1]); + if (argument) check(argument); + } +} diff --git a/packages/lint/src/mod.ts b/packages/lint/src/mod.ts index 27a652505..693c667af 100644 --- a/packages/lint/src/mod.ts +++ b/packages/lint/src/mod.ts @@ -86,12 +86,15 @@ import { deno as outboxListenerDeliveryRequired, } from "./rules/outbox-listener-delivery-required.ts"; +import { deno as rawPropertyIriInvalid } from "./rules/raw-property-iri-invalid.ts"; + // `outbox-listener-delivery-not-awaited` is deliberately not registered here: // Deno turns on every rule of a plugin as soon as the plugin is listed, and // gives the rule no way to stay off until a project asks for it. const plugin: Deno.lint.Plugin = { name: "fedify-lint", rules: { + [RULE_IDS.rawPropertyIriInvalid]: rawPropertyIriInvalid, [RULE_IDS.actorIdMismatch]: actorIdMismatch, [RULE_IDS.actorIdRequired]: actorIdRequired, [RULE_IDS.actorFollowingPropertyRequired]: actorFollowingPropertyRequired, diff --git a/packages/lint/src/oxlint.ts b/packages/lint/src/oxlint.ts index 3058c49aa..551e899dd 100644 --- a/packages/lint/src/oxlint.ts +++ b/packages/lint/src/oxlint.ts @@ -106,10 +106,13 @@ import { eslint as outboxListenerDeliveryRequired, } from "./rules/outbox-listener-delivery-required.ts"; +import { eslint as rawPropertyIriInvalid } from "./rules/raw-property-iri-invalid.ts"; + const rules: Record< typeof RULE_IDS[keyof typeof RULE_IDS], Rule.RuleModule > = { + [RULE_IDS.rawPropertyIriInvalid]: rawPropertyIriInvalid, [RULE_IDS.actorIdMismatch]: actorIdMismatch, [RULE_IDS.actorIdRequired]: actorIdRequired, [RULE_IDS.actorFollowingPropertyRequired]: actorFollowingPropertyRequired, diff --git a/packages/lint/src/rules/raw-property-iri-invalid.ts b/packages/lint/src/rules/raw-property-iri-invalid.ts new file mode 100644 index 000000000..3227ba581 --- /dev/null +++ b/packages/lint/src/rules/raw-property-iri-invalid.ts @@ -0,0 +1,73 @@ +import type { Rule } from "eslint"; +import { RAW_PROPERTY_IRI_MESSAGES } from "../lib/messages.ts"; +import { + checkRawPropertyIris, + type RawPropertyIriOptions, +} from "../lib/raw-property-iri.ts"; + +/** Check statically known raw-property IRIs using Deno's default modules. */ +export const deno: Deno.lint.Rule = { + create(context) { + return { + Program(node) { + checkRawPropertyIris(node, { modules: [] }, (diagnostic) => { + const { value, replacement, messageId } = diagnostic; + const hint = replacement ? ` Did you mean "${replacement}"?` : ""; + context.report({ + node: diagnostic.node as Deno.lint.Node, + message: RAW_PROPERTY_IRI_MESSAGES[messageId] + .replace("{{value}}", () => value).replace( + "{{hint}}", + () => hint, + ), + }); + }); + }, + }; + }, +}; + +/** ESLint and Oxlint adapter, with optional generated vocabulary modules. */ +export const eslint: Rule.RuleModule = { + meta: { + type: "problem", + docs: { description: "Check full IRIs passed to raw-property helpers" }, + hasSuggestions: true, + messages: RAW_PROPERTY_IRI_MESSAGES, + schema: [{ + type: "object", + properties: { modules: { type: "array", items: { type: "string" } } }, + additionalProperties: false, + }], + }, + create(context) { + const options: RawPropertyIriOptions = context.options[0] ?? + { modules: [] }; + return { + Program(node) { + checkRawPropertyIris(node, options, (diagnostic) => { + const { value, replacement, messageId, suggestionNode } = diagnostic; + context.report({ + node: diagnostic.node as Rule.Node, + messageId, + data: { + value, + hint: replacement ? ` Did you mean "${replacement}"?` : "", + }, + suggest: replacement && suggestionNode + ? [{ + messageId: "expandPrefix", + data: { replacement }, + fix: (fixer) => + fixer.replaceText( + suggestionNode as Rule.Node, + JSON.stringify(replacement), + ), + }] + : undefined, + }); + }); + }, + }; + }, +}; diff --git a/packages/lint/src/tests/raw-property-iri-invalid.test.ts b/packages/lint/src/tests/raw-property-iri-invalid.test.ts new file mode 100644 index 000000000..9b46b4b4a --- /dev/null +++ b/packages/lint/src/tests/raw-property-iri-invalid.test.ts @@ -0,0 +1,412 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { Linter } from "eslint"; +import * as parser from "@typescript-eslint/parser"; +import lintTest from "../lib/test.ts"; +import * as rule from "../rules/raw-property-iri-invalid.ts"; +import { oxlintUnavailable, runOxlint } from "../lib/oxlint.ts"; + +const ruleName = "raw-property-iri-invalid"; +const setup = 'import { getRawPropertyValues as read } from "@fedify/vocab";'; +const cases: [string, string, string?][] = [ + ...[ + "", + "as:", + "https://example/path[0]", + "https://[abc]/x", + "https://a[::1]/x", + "https://example:abc/p", + "https://example:80:90/p", + "https://example/\ud800", + "@id", + "_:node", + "content", + "/x", + "#x", + "https://example/x y", + "https://example/%xx", + "https://example/#a#b", + "https://example/\u0001", + 'https://example/"', + "https://example/<", + "https://example/>", + "https://example/\\", + "https://example/^", + "https://example/`", + "https://example/{", + "https://example/|", + "https://example/}", + ].map((value): [string, string, string] => [ + `invalid ${JSON.stringify(value)}`, + `${setup} read(obj, ${JSON.stringify(value)});`, + "must be a full", + ]), + [ + "compact prefix", + `${setup} read(obj, "as:content");`, + 'Did you mean "https://www.w3.org/ns/activitystreams#content"?', + ], + [ + "other scheme", + `${setup} read(obj, "urn:example:property");`, + "non-HTTP scheme", + ], + ["uppercase HTTPS", `${setup} read(obj, "HTTPS://example/prop");`], + ["unicode IRI", `${setup} read(obj, "https://example/이름");`], + ["aliased import", `${setup} read(obj, "content");`, "must be a full"], + [ + "namespace", + 'import * as vocab from "@fedify/vocab"; vocab.getRawPropertyValue(obj, "content");', + "must be a full", + ], + [ + "computed namespace", + 'import * as vocab from "@fedify/vocab"; vocab["getRawPropertyValue"](obj, "content");', + "must be a full", + ], + [ + "shadowed function parameter", + `${setup} function f(read) { read(obj, "content"); }`, + ], + [ + "shadowed namespace", + 'import * as vocab from "@fedify/vocab"; function f(vocab) { vocab.getRawPropertyValue(obj, "content"); }', + ], + [ + "hoisted shadow", + `${setup} function f() { read(obj, "content"); var read; }`, + ], + ["block shadow", `${setup} { read(obj, "content"); const read = local; }`], + [ + "destructured parameter", + `${setup} function f({read}) { read(obj, "content"); }`, + ], + ["catch shadow", `${setup} try {} catch (read) { read(obj, "content"); }`], + [ + "loop shadow", + `${setup} for (const read of readers) { read(obj, "content"); }`, + ], + [ + "const", + `${setup} const iri = "content"; read(obj, iri);`, + "must be a full", + ], + [ + "const chain", + `${setup} const iri = "content"; const key = iri; read(obj, key);`, + "must be a full", + ], + [ + "const shadow", + `${setup} const iri = "content"; function f(iri) { read(obj, iri); }`, + ], + ["const cycle", `${setup} const a = b; const b = a; read(obj, a);`], + ["mutable binding ignored", `${setup} let iri = "content"; read(obj, iri);`], + ["template", `${setup} read(obj, \`content\`);`, "must be a full"], + ["dynamic template", `${setup} read(obj, \`https://example/\${key}\`);`], + [ + "URL without base", + `${setup} read(obj, new URL("content"));`, + "must be a full", + ], + ["URL valid", `${setup} read(obj, new URL("https://example/key"));`], + [ + "URL normalized before checking", + `${setup} read(obj, new URL("https://example/a b"));`, + ], + [ + "URL const ignored, as it can be mutated", + `${setup} const iri = new URL("about:blank"); iri.href = "https://example/p"; read(obj, iri);`, + ], + [ + "URL with base", + `${setup} read(obj, new URL("content", "https://example/"));`, + ], + [ + "shadowed URL", + `${setup} function f(URL) { read(obj, new URL("content")); }`, + ], + ["dynamic ignored", `${setup} read(obj, getIri());`], + [ + "other module", + 'import { getRawPropertyValue } from "other-vocab"; getRawPropertyValue(obj, "content");', + ], + [ + "type import", + 'import type { getRawPropertyValue } from "@fedify/vocab"; getRawPropertyValue(obj, "content");', + ], + ...[ + "jsr:@fedify/vocab", + "npm:@fedify/vocab", + "jsr:@fedify/vocab@^2.5.0", + "npm:@fedify/vocab@2.5.0", + "@fedify/fedify/vocab", + "jsr:@fedify/fedify@^2.5.0/vocab", + ].map(( + source, + ): [string, string, string] => [ + source, + `import { getRawPropertyValue } from ${ + JSON.stringify(source) + }; getRawPropertyValue(obj, "content");`, + "must be a full", + ]), +]; +cases.push( + [ + "exported function", + `${setup} export function f() { read(obj, "content"); }`, + "must be a full", + ], + [ + "exported shadow", + `${setup} export function f(read) { read(obj, "content"); }`, + ], + [ + "prototype prefix", + `${setup} read(obj, "constructor:property");`, + "non-HTTP scheme", + ], + [ + "single-quoted lone surrogate", + `${setup} read(obj, 'https://example/\\uD800');`, + "must be a full", + ], + [ + "single-quoted surrogate pair", + `${setup} read(obj, 'https://example/\\uD83D\\uDE00');`, + ], + [ + "single-quoted double quote", + `${setup} read(obj, 'https://example/"\\u0070');`, + "must be a full", + ], + [ + "single-quoted valid", + `${setup} read(obj, 'https://example/\\u0070rop\\'s');`, + ], + [ + "switch discriminant outside case scope", + `${setup} const iri = "https://example/p"; switch (read(obj, iri)) { case 0: const iri = "content"; }`, + ], + [ + "namespace body scope", + `${setup} const iri = "https://example/p"; namespace N { export const iri = "content"; var other = 1; } read(obj, iri);`, + ], + [ + "inside namespace body", + `${setup} namespace N { const iri = "content"; read(obj, iri); }`, + "must be a full", + ], + [ + "namespace shadows namespace import", + 'import * as vocab from "@fedify/vocab"; namespace vocab { export function getRawPropertyValue(o: unknown, i: string) {} } vocab.getRawPropertyValue({}, "content");', + ], + [ + "enum shadows namespace import", + 'import * as vocab from "@fedify/vocab"; enum vocab { getRawPropertyValue } vocab.getRawPropertyValue({}, "content");', + ], + [ + "type-only namespace does not shadow", + `${setup} namespace Outer { namespace read { export interface X {} } read(obj, "content"); }`, + "must be a full", + ], + [ + "namespace with values shadows", + `${setup} namespace Outer { namespace read { export const x = 1; } read(obj, "content"); }`, + ], + [ + "namespace with only an import alias does not shadow", + `${setup} namespace Outer { namespace read { import X = Outer.Y; } read(obj, "content"); }`, + "must be a full", + ], + [ + "import alias shadows outer bindings", + `${setup} const iri = "content"; namespace M { export const iri = "https://example/p"; } namespace N { import iri = M.iri; read(obj, iri); }`, + ], + [ + "merged namespace members hide outer bindings", + `${setup} const iri = "content"; namespace N { export const iri = "https://example/p"; } namespace N { read(obj, iri); }`, + ], + [ + "merged enum members hide outer bindings", + `${setup} const iri = "content"; enum E { iri = "https://example/p" } enum E { V = (read(obj, iri), 0) }`, + ], + [ + "merged namespace exports shadow helpers", + `${setup} namespace N { export function read(o: unknown, i: string) {} } namespace N { read({}, "content"); }`, + ], + [ + "merged namespace exported variables shadow helpers", + `${setup} namespace N { export const read = (o: unknown, i: string) => {}; } namespace N { read({}, "content"); }`, + ], + [ + "nested merged namespace exports shadow helpers", + `${setup} namespace N { export namespace Inner { export function read(o: unknown, i: string) {} } } namespace N { export namespace Inner { read({}, "content"); } }`, + ], + [ + "merged namespace locals do not shadow helpers", + `${setup} namespace N { function read(o: unknown, i: string) {} } namespace N { read({}, "content"); }`, + "must be a full", + ], + [ + "unrelated namespace exports do not shadow helpers", + `${setup} namespace M { export function read(o: unknown, i: string) {} } namespace N { read({}, "content"); }`, + "must be a full", + ], + [ + "merged enum members shadow helpers", + `${setup} enum E { read = 1 } enum E { V = (read({}, "content"), 0) }`, + ], + [ + "enum members shadow outer bindings", + `${setup} const iri = "content"; enum E { iri = "https://example/p", V = (read(obj, iri), 0) }`, + ], + [ + "enum initializers are checked", + `${setup} enum E { V = (read(obj, "content"), 0) }`, + "must be a full", + ], + ["numeric port", `${setup} read(obj, "https://u:p@example:8080/p");`], + ["IPv6 authority", `${setup} read(obj, "https://[::1]/property");`], + [ + "IPvFuture authority", + `${setup} read(obj, "urn://[v1.fe80::a+en1]/p");`, + "non-HTTP scheme", + ], + [ + "escaped template", + `${setup} read(obj, \`con\\u0074ent\`);`, + "must be a full", + ], +); +for (const [label, code, expectedError] of cases) { + test( + `${ruleName}: ${label}`, + lintTest({ rule, ruleName, code, federationSetup: "", expectedError }), + ); +} + +function verify(code: string, options: { modules?: string[] } = {}) { + return new Linter().verify(code, [{ + files: ["**/*.ts"], + languageOptions: { parser }, + plugins: { fedify: { rules: { [ruleName]: rule.eslint } } }, + rules: { [`fedify/${ruleName}`]: ["warn", options] }, + }], "test.ts"); +} + +test("ESLint: modules option includes defaults and accepts frozen options", () => { + const options = Object.freeze({ modules: Object.freeze(["other-vocab"]) }); + // ESLint normalizes configuration before invoking the rule; frozen input + // also guards against accidental mutations of the caller's options. + const code = + 'import { getRawPropertyValue as read } from "other-vocab"; read(obj, "content");'; + assert.equal(verify(code).length, 0); + assert.equal( + verify(code, options as { modules: string[] })[0].messageId, + "invalid", + ); + assert.equal( + verify(`${setup} read(obj, "content");`, options as { modules: string[] }) + .length, + 1, + ); +}); + +test("ESLint: enum initializers are reported once", () => { + assert.equal( + verify(`${setup} enum E { V = (read(obj, "content"), 0) }`).length, + 1, + ); +}); + +test("ESLint: compact prefixes offer suggestions, never autofixes", () => { + const code = `${setup} read(obj, "as:content");`; + const [diagnostic] = verify(code); + assert.equal(diagnostic.messageId, "nonHttp"); + assert.equal(diagnostic.fix, undefined); + assert.equal(diagnostic.suggestions?.length, 1); + const fix = diagnostic.suggestions![0].fix; + const fixed = code.slice(0, fix.range[0]) + fix.text + + code.slice(fix.range[1]); + assert.equal(verify(fixed).length, 0); + assert.equal( + verify(`${setup} const iri = "as:content"; read(obj, iri);`)[0].suggestions, + undefined, + ); +}); + +test("ESLint: template and URL suggestions produce valid code", () => { + for ( + const code of [ + `${setup} read(obj, \`as:content\`);`, + `${setup} read(obj, new URL("as:content"));`, + ] + ) { + const [diagnostic] = verify(code); + const fix = diagnostic.suggestions![0].fix; + assert.equal( + verify(code.slice(0, fix.range[0]) + fix.text + code.slice(fix.range[1])) + .length, + 0, + ); + } +}); + +test( + "Oxlint: default and configured modules", + { skip: oxlintUnavailable }, + () => { + for ( + const [source, options, expected] of [ + ["@fedify/vocab", {}, 1], + ["other-vocab", {}, 0], + ["other-vocab", { modules: ["other-vocab"] }, 1], + ] as const + ) { + const result = runOxlint( + `import { getRawPropertyValue } from ${ + JSON.stringify(source) + }; getRawPropertyValue(obj, "content");`, + { + rules: { [`@fedify/lint/${ruleName}`]: ["warn", options] }, + }, + ); + assert.equal( + result.diagnostics.filter((d) => d.code?.includes(ruleName)).length, + expected, + result.stdout + result.stderr, + ); + } + }, +); + +test("ESLint: every well-known prefix expands to its full IRI", () => { + const prefixes = { + as: "https://www.w3.org/ns/activitystreams#", + dcterms: "http://purl.org/dc/terms/", + fedibird: "http://fedibird.com/ns#", + ldp: "http://www.w3.org/ns/ldp#", + litepub: "http://litepub.social/ns#", + misskey: "https://misskey-hub.net/ns#", + schema: "http://schema.org#", + sec: "https://w3id.org/security#", + toot: "http://joinmastodon.org/ns#", + vcard: "http://www.w3.org/2006/vcard/ns#", + }; + for (const [prefix, namespace] of Object.entries(prefixes)) { + const [diagnostic] = verify(`${setup} read(obj, "${prefix}:property");`); + assert.ok( + diagnostic.message.includes(`Did you mean "${namespace}property"?`), + ); + assert.equal( + diagnostic.suggestions![0].fix.text, + JSON.stringify(namespace + "property"), + ); + } + assert.equal( + verify(`${setup} read(obj, "constructor:property");`)[0].suggestions, + undefined, + ); +}); diff --git a/packages/vocab-runtime/deno.json b/packages/vocab-runtime/deno.json index 4089387b2..ef74b478b 100644 --- a/packages/vocab-runtime/deno.json +++ b/packages/vocab-runtime/deno.json @@ -6,6 +6,7 @@ ".": "./src/mod.ts", "./internal/jsonld-cache": "./src/internal/jsonld-cache.ts", "./internal/portable-dereference": "./src/internal/portable-dereference.ts", + "./internal/raw-property": "./src/internal/raw-property.ts", "./internal/signed-representation": "./src/internal/signed-representation.ts", "./internal": "./src/internal.ts", "./jsonld": "./src/jsonld.ts", diff --git a/packages/vocab-runtime/package.json b/packages/vocab-runtime/package.json index 16a0a7c3c..47d3c5bc4 100644 --- a/packages/vocab-runtime/package.json +++ b/packages/vocab-runtime/package.json @@ -72,6 +72,16 @@ "require": "./dist/internal/portable-dereference.cjs", "default": "./dist/internal/portable-dereference.js" }, + "./internal/raw-property": { + "types": { + "import": "./dist/internal/raw-property.d.ts", + "require": "./dist/internal/raw-property.d.cts", + "default": "./dist/internal/raw-property.d.ts" + }, + "import": "./dist/internal/raw-property.js", + "require": "./dist/internal/raw-property.cjs", + "default": "./dist/internal/raw-property.js" + }, "./internal/signed-representation": { "types": { "import": "./dist/internal/signed-representation.d.ts", diff --git a/packages/vocab-runtime/src/internal/raw-property.test.ts b/packages/vocab-runtime/src/internal/raw-property.test.ts new file mode 100644 index 000000000..cee02dbcf --- /dev/null +++ b/packages/vocab-runtime/src/internal/raw-property.test.ts @@ -0,0 +1,219 @@ +import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert"; +import { test } from "node:test"; +import { + createRawPropertyEncodingOptions, + encodeNestedVocabularyValue, + expandRawPropertyValue, + parseRawPropertyIri, + RAW_PROPERTY_PROTOCOL, + readRawPropertyValues, + retainRawProperties, +} from "./raw-property.ts"; + +test("parseRawPropertyIri() accepts absolute IRIs", () => { + deepStrictEqual( + parseRawPropertyIri("https://example.com/ns#prop", "f"), + ["https://example.com/ns#prop"], + ); + deepStrictEqual( + parseRawPropertyIri(new URL("https://example.com/ns#prop"), "f"), + ["https://example.com/ns#prop"], + ); + deepStrictEqual( + parseRawPropertyIri("HTTPS://Example.COM/ns#prop", "f"), + ["HTTPS://Example.COM/ns#prop", "https://example.com/ns#prop"], + ); + deepStrictEqual( + parseRawPropertyIri("https://例え.jp/語#性質", "f")[0], + "https://例え.jp/語#性質", + ); + deepStrictEqual(parseRawPropertyIri("https://[::1]/ns#prop", "f"), [ + "https://[::1]/ns#prop", + ]); + deepStrictEqual( + parseRawPropertyIri("https://user@[2001:db8::1]:8080/ns#prop", "f"), + ["https://user@[2001:db8::1]:8080/ns#prop"], + ); + deepStrictEqual(parseRawPropertyIri("urn://[v1.fe80::a+en1]/p", "f"), [ + "urn://[v1.fe80::a+en1]/p", + ]); + deepStrictEqual( + parseRawPropertyIri("https://user:pass@example.com:8080/p", "f"), + ["https://user:pass@example.com:8080/p"], + ); + deepStrictEqual( + parseRawPropertyIri("https://example.com:/p", "f")[0], + "https://example.com:/p", + ); + deepStrictEqual(parseRawPropertyIri("urn:example:prop", "f"), [ + "urn:example:prop", + ]); +}); + +test("parseRawPropertyIri() rejects what is not an absolute IRI", () => { + for ( + const iri of [ + "", + "@id", + "@vocab", + "_:b0", + "content", + "/content", + "#content", + "../content", + "https:", + "https://example.com/a b", + " https://example.com/", + "https://example.com/\n", + "https://example.com/", + "https://example.com/%", + "https://example.com/%2", + "https://example.com/#a#b", + "https://example.com/[a]", + "https://[abc]/x", + "https://[::1/x", + "https://::1]/x", + "https://[::1]x/y", + "https://a[::1]/x", + "https://[u@]::1]/x", + "https://[v1]/x", + "https://example.com:abc/p", + "https://example.com:80:90/p", + "https://user@example.com:8a/p", + "https://example.com/\uD800", + ] + ) { + throws(() => parseRawPropertyIri(iri, "f"), TypeError, JSON.stringify(iri)); + } + throws(() => parseRawPropertyIri(null, "f"), TypeError); + throws(() => parseRawPropertyIri(123, "f"), TypeError); +}); + +test("retainRawProperties() keeps only unknown properties", () => { + const node = { + "@id": "https://example.com/", + "@type": ["https://example.com/Type"], + "_:gateways": [{ "@value": "x" }], + "https://example.com/known": [{ "@value": 1 }], + "https://example.com/unknown": [{ "@value": { a: [1] }, "@type": "@json" }], + }; + const retained = retainRawProperties( + node, + new Set(["https://example.com/known"]), + ); + deepStrictEqual(retained, { + "https://example.com/unknown": [{ "@value": { a: [1] }, "@type": "@json" }], + }); + ok(Object.isFrozen(retained)); + ok(Object.isFrozen(retained!["https://example.com/unknown"])); + ok( + Object.isFrozen( + (retained!["https://example.com/unknown"][0] as { "@value": object })[ + "@value" + ], + ), + ); + // The retained values are independent of the input node: + node["https://example.com/unknown"][0]["@value"].a.push(2); + deepStrictEqual(retained!["https://example.com/unknown"], [ + { "@value": { a: [1] }, "@type": "@json" }, + ]); + strictEqual( + retainRawProperties( + { "https://example.com/known": [] }, + new Set(["https://example.com/known"]), + ), + undefined, + ); +}); + +test("expandRawPropertyValue() normalizes encoded values", async () => { + deepStrictEqual( + await expandRawPropertyValue("https://example.com/p", [ + { "@value": "a" }, + { "@id": "https://example.com/" }, + ]), + [{ "@value": "a" }, { "@id": "https://example.com/" }], + ); + deepStrictEqual( + await expandRawPropertyValue("https://example.com/p", { + "@list": [{ "@value": 1 }], + }), + [{ "@list": [{ "@value": 1 }] }], + ); +}); + +test("encodeNestedVocabularyValue() rejects cycles, not shared objects", async () => { + const a = {}; + const b = {}; + const stack = new Set([a]); + const options = createRawPropertyEncodingOptions(stack); + // Shared object, visited twice in sequence: + strictEqual( + await encodeNestedVocabularyValue(options, b, () => Promise.resolve(1)), + 1, + ); + strictEqual( + await encodeNestedVocabularyValue(options, b, () => Promise.resolve(2)), + 2, + ); + deepStrictEqual([...stack], [a]); + // Cycle back to an object that is being encoded: + await rejects( + () => + encodeNestedVocabularyValue( + options, + b, + () => encodeNestedVocabularyValue(options, a, () => Promise.resolve(3)), + ), + TypeError, + ); + deepStrictEqual([...stack], [a]); + // Without the raw property options, no tracking takes place: + strictEqual( + await encodeNestedVocabularyValue({}, a, () => Promise.resolve(4)), + 4, + ); + // The tracking survives spreading, as toJsonLd() does with its options: + await rejects( + () => + encodeNestedVocabularyValue( + { ...options, contextLoader: undefined }, + a, + () => Promise.resolve(5), + ), + TypeError, + ); +}); + +test("readRawPropertyValues() dispatches through the protocol", async () => { + const requests: unknown[] = []; + const retained = Object.freeze([Object.freeze({ "@value": "x" })]); + const object = { + [RAW_PROPERTY_PROTOCOL](request: unknown) { + requests.push(request); + return Promise.resolve(retained); + }, + }; + const values = await readRawPropertyValues( + object, + "HTTPS://example.com/p", + "f", + ); + deepStrictEqual(values, [{ "@value": "x" }]); + ok(!Object.isFrozen(values[0])); + strictEqual(requests.length, 1); + deepStrictEqual( + (requests[0] as { candidates: string[] }).candidates, + ["HTTPS://example.com/p", "https://example.com/p"], + ); + ok((requests[0] as { stack: Set }).stack.has(object)); + await rejects( + () => readRawPropertyValues({}, "https://example.com/p", "f"), + TypeError, + ); + await rejects( + () => readRawPropertyValues(null, "https://example.com/p", "f"), + TypeError, + ); +}); diff --git a/packages/vocab-runtime/src/internal/raw-property.ts b/packages/vocab-runtime/src/internal/raw-property.ts new file mode 100644 index 000000000..53e231b99 --- /dev/null +++ b/packages/vocab-runtime/src/internal/raw-property.ts @@ -0,0 +1,410 @@ +import { getLogger } from "@logtape/logtape"; +import type { DocumentLoader } from "../docloader.ts"; +import jsonld from "../jsonld.ts"; +import type { RawPropertyValue } from "../vocabulary-object.ts"; + +/** + * The key of the method through which the raw property functions reach the + * per-class logic of generated vocabulary classes. It is registered with + * `Symbol.for()`, so that the functions generated into one module can read + * objects generated into another, even when the modules depend on different + * copies of this package. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export const RAW_PROPERTY_PROTOCOL: unique symbol = Symbol.for( + "@fedify/vocab-runtime.rawPropertyProtocol.v1", +) as never; + +const RAW_PROPERTY_ENCODING_STACK = Symbol.for( + "@fedify/vocab-runtime.rawPropertyEncodingStack.v1", +); + +/** + * A request passed to the {@link RAW_PROPERTY_PROTOCOL} method. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export interface RawPropertyRequest { + /** + * The property IRIs to look up, in order of preference. The first one + * that is either a known property of the object or a retained unknown + * property is used. + */ + readonly candidates: readonly string[]; + + /** + * The objects that are being encoded, used to detect cycles. + */ + readonly stack: Set; +} + +/** + * The signature of the {@link RAW_PROPERTY_PROTOCOL} method. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export type RawPropertyProtocolMethod = ( + this: object, + request: RawPropertyRequest, +) => Promise; + +/** + * Unknown properties retained while decoding an object, keyed by their full + * property IRIs. The record and its values are deeply frozen. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export type RetainedRawProperties = Readonly< + Record +>; + +function deepFreeze(value: T): T { + if (value == null || typeof value !== "object") return value; + for (const child of Object.values(value)) deepFreeze(child); + return Object.freeze(value); +} + +/** + * Collects the properties of an expanded JSON-LD node that are not known to + * the class decoding it. JSON-LD keywords and blank node identifiers used as + * keys are not properties, so they are never retained. + * + * @param node The expanded JSON-LD node. + * @param knownIris The full IRIs of the properties the class decodes, + * including inherited properties and redundant aliases. + * @returns The deeply frozen unknown properties, or `undefined` if there are + * none. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export function retainRawProperties( + node: Record, + knownIris: ReadonlySet, +): RetainedRawProperties | undefined { + let retained: Record | undefined; + for (const [key, value] of Object.entries(node)) { + if (key.startsWith("@") || key.startsWith("_:") || knownIris.has(key)) { + continue; + } + if (!Array.isArray(value)) continue; + retained ??= {}; + retained[key] = structuredClone(value); + } + return retained == null ? undefined : deepFreeze(retained); +} + +/** + * Normalizes the values of a known property, which a generated encoder + * produced in the same shape as `toJsonLd({ format: "expand" })` does, into + * expanded JSON-LD. + * + * @param iri The full IRI of the property. + * @param value The encoded property value: an array of values, or a list + * object. + * @param contextLoader The loader for remote JSON-LD contexts. The encoded + * value has no context, so it is not expected to be + * used. + * @returns The expanded values of the property. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export async function expandRawPropertyValue( + iri: string, + value: unknown, + contextLoader?: DocumentLoader, +): Promise { + const expanded = await jsonld.expand( + { [iri]: value } as Parameters[0], + { documentLoader: contextLoader, keepFreeFloatingNodes: true }, + ); + const node = expanded[0] as Record | undefined; + const values = node?.[iri]; + return Array.isArray(values) ? values : []; +} + +/** + * Creates the options that a generated per-property encoder passes to the + * `toJsonLd()` method of nested vocabulary objects. + * + * @param stack The objects that are being encoded. + * @param contextLoader The loader for remote JSON-LD contexts. + * @returns The options for `toJsonLd()`. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export function createRawPropertyEncodingOptions( + stack: Set, + contextLoader?: DocumentLoader, +): { format: "expand"; contextLoader?: DocumentLoader } { + return { + format: "expand", + contextLoader, + [RAW_PROPERTY_ENCODING_STACK]: stack, + } as { format: "expand"; contextLoader?: DocumentLoader }; +} + +/** + * Encodes a nested vocabulary object. When the encoding was started by a raw + * property function, it tracks the objects being encoded and throws on a + * cycle. Otherwise, it just calls `encode()`. + * + * @param options The options of the enclosing `toJsonLd()` call. + * @param value The nested object to encode. + * @param encode The function that encodes `value`. + * @returns The result of `encode()`. + * @throws {TypeError} If `value` is already being encoded, i.e., the object + * graph has a cycle. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export async function encodeNestedVocabularyValue( + options: object, + value: object, + encode: () => Promise, +): Promise { + const stack = (options as Record)[ + RAW_PROPERTY_ENCODING_STACK + ] as Set | undefined; + if (stack == null) return await encode(); + if (stack.has(value)) { + throw new TypeError( + "Cannot encode the raw property values of a cyclic object graph.", + ); + } + stack.add(value); + try { + return await encode(); + } finally { + stack.delete(value); + } +} + +const SCHEME_PATTERN = /^([A-Za-z][A-Za-z0-9+.-]*):/; + +// Characters that RFC 3987 does not allow anywhere in an IRI: controls, +// space, and the excluded ASCII characters. +// deno-lint-ignore no-control-regex +const INVALID_CHAR_PATTERN = /[\u0000- "<>\\^`{|}\u007f-\u009f]/; + +const INVALID_PERCENT_PATTERN = /%(?![0-9A-Fa-f]{2})/; + +const LONE_SURROGATE_PATTERN = + /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?> = { + as: "https://www.w3.org/ns/activitystreams#", + dcterms: "http://purl.org/dc/terms/", + fedibird: "http://fedibird.com/ns#", + ldp: "http://www.w3.org/ns/ldp#", + litepub: "http://litepub.social/ns#", + misskey: "https://misskey-hub.net/ns#", + schema: "http://schema.org#", + sec: "https://w3id.org/security#", + toot: "http://joinmastodon.org/ns#", + vcard: "http://www.w3.org/2006/vcard/ns#", +}; + +const MAX_WARNED_IRIS = 1024; +const warnedIris = new Set(); + +function warnUnusualScheme( + iri: string, + scheme: string, + functionName: string, +): void { + if (warnedIris.has(iri)) return; + warnedIris.add(iri); + if (warnedIris.size > MAX_WARNED_IRIS) { + warnedIris.delete(warnedIris.values().next().value!); + } + const logger = getLogger(["fedify", "vocab"]); + const namespace = Object.hasOwn(WELL_KNOWN_PREFIXES, scheme) + ? WELL_KNOWN_PREFIXES[scheme] + : undefined; + if (namespace == null) { + logger.warn( + "The property IRI {iri} passed to {function}() uses the {scheme}: " + + "scheme rather than http: or https:. Note that compact IRIs are " + + "not expanded; pass the full property IRI.", + { iri, scheme, function: functionName }, + ); + } else { + const suggestion = namespace + iri.substring(scheme.length + 1); + logger.warn( + "The property IRI {iri} passed to {function}() looks like a compact " + + "IRI, which is not expanded. Did you mean {suggestion}?", + { iri, scheme, function: functionName, suggestion }, + ); + } +} + +/** + * Validates a property IRI passed to a raw property function and returns the + * keys to look it up by. + * + * @param iri The property IRI. + * @param functionName The name of the public function, used in messages. + * @returns The lookup keys, in order of preference: the IRI as given, then + * its WHATWG URL serialization if that differs. + * @throws {TypeError} If `iri` is not a string or a `URL`, or is not an + * absolute IRI. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export function parseRawPropertyIri( + iri: unknown, + functionName: string, +): string[] { + let exact: string; + if (typeof iri === "string") exact = iri; + else if (iri instanceof URL) exact = iri.href; + else { + throw new TypeError( + `The property IRI passed to ${functionName}() must be a string or a ` + + "URL.", + ); + } + if (exact === "") { + throw new TypeError( + `The property IRI passed to ${functionName}() must not be empty.`, + ); + } + if (exact.startsWith("@")) { + throw new TypeError( + `${functionName}() does not accept JSON-LD keywords such as ` + + `${JSON.stringify(exact)}; pass a full property IRI.`, + ); + } + if (exact.startsWith("_:")) { + throw new TypeError( + `${functionName}() does not accept blank node identifiers such as ` + + `${JSON.stringify(exact)}; pass a full property IRI.`, + ); + } + const match = SCHEME_PATTERN.exec(exact); + if (match == null) { + throw new TypeError( + `The property IRI passed to ${functionName}() must be an absolute ` + + `IRI, but got ${JSON.stringify(exact)}. Terms and relative ` + + "references are not expanded.", + ); + } + if (!isIriSyntax(exact.substring(match[0].length))) { + throw new TypeError( + `The property IRI passed to ${functionName}() is not a valid IRI: ` + + `${JSON.stringify(exact)}.`, + ); + } + const scheme = match[1].toLowerCase(); + if (scheme !== "http" && scheme !== "https") { + warnUnusualScheme(exact, match[1], functionName); + } + const keys = [exact]; + if (typeof iri === "string" && URL.canParse(exact)) { + const normalized = new URL(exact).href; + if (normalized !== exact) keys.push(normalized); + } + return keys; +} + +function isIriSyntax(rest: string): boolean { + if (rest === "") return false; + if ( + INVALID_CHAR_PATTERN.test(rest) || INVALID_PERCENT_PATTERN.test(rest) || + LONE_SURROGATE_PATTERN.test(rest) + ) { + return false; + } + const fragmentIndex = rest.indexOf("#"); + if (fragmentIndex >= 0 && rest.indexOf("#", fragmentIndex + 1) >= 0) { + return false; + } + // Square brackets may only delimit an IP literal in the authority: + let path = rest; + if (rest.startsWith("//")) { + const end = rest.slice(2).search(/[/?#]/); + const authority = end < 0 ? rest.slice(2) : rest.slice(2, 2 + end); + if (!isAuthoritySyntax(authority)) return false; + path = end < 0 ? "" : rest.slice(2 + end); + } + return !path.includes("[") && !path.includes("]"); +} + +const IP_LITERAL_PATTERN = /^\[([^\[\]]*)\](?::[0-9]*)?$/; +const IP_FUTURE_PATTERN = /^v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+$/i; + +/** + * Checks that an authority has a numeric port, if any, and that square + * brackets delimit an IPv6 address or an IPvFuture literal as the whole host, + * as RFC 3986 requires. + */ +function isAuthoritySyntax(authority: string): boolean { + const hostPort = authority.slice(authority.lastIndexOf("@") + 1); + const userinfo = authority.slice(0, authority.length - hostPort.length); + if (/[[\]]/.test(userinfo)) return false; + if (!/[[\]]/.test(hostPort)) return /^[^:]*(?::[0-9]*)?$/.test(hostPort); + const match = IP_LITERAL_PATTERN.exec(hostPort); + if (match == null) return false; + const literal = match[1]; + return IP_FUTURE_PATTERN.test(literal) || + // The WHATWG URL parser accepts IPv6 addresses, but not IPvFuture: + URL.canParse(`http://[${literal}]/`); +} + +/** + * Implements the `getRawPropertyValues()` function generated into every + * vocabulary module. + * + * @param object The vocabulary object to read. + * @param propertyIri The full IRI of the property. + * @param functionName The name of the public function, used in messages. + * @returns Deep copies of the property's values in expanded JSON-LD. + * + * @internal Technically exported for generated vocabulary classes, but not + * part of the public API contract. This is not considered public API for + * Semantic Versioning decisions. + */ +export async function readRawPropertyValues( + object: unknown, + propertyIri: unknown, + functionName: string, +): Promise { + const candidates = parseRawPropertyIri(propertyIri, functionName); + const method = object == null || typeof object !== "object" + ? undefined + : (object as Record)[RAW_PROPERTY_PROTOCOL]; + if (typeof method !== "function") { + throw new TypeError( + `${functionName}() expects a vocabulary object generated by ` + + "@fedify/vocab-tools.", + ); + } + const values = await (method as RawPropertyProtocolMethod).call( + object as object, + { candidates, stack: new Set([object as object]) }, + ); + return structuredClone(values) as RawPropertyValue[]; +} diff --git a/packages/vocab-runtime/src/mod.ts b/packages/vocab-runtime/src/mod.ts index 946f28b83..b3df2aa95 100644 --- a/packages/vocab-runtime/src/mod.ts +++ b/packages/vocab-runtime/src/mod.ts @@ -78,6 +78,13 @@ export { type PropertyPreprocessor, type PropertyPreprocessorContext, } from "./preprocessor.ts"; +export type { + RawListObject, + RawNodeObject, + RawPropertyValue, + RawValueObject, + VocabularyObject, +} from "./vocabulary-object.ts"; export { arePortableUrisEqual, canonicalizePortableUri, diff --git a/packages/vocab-runtime/src/vocabulary-object.ts b/packages/vocab-runtime/src/vocabulary-object.ts new file mode 100644 index 000000000..28882560d --- /dev/null +++ b/packages/vocab-runtime/src/vocabulary-object.ts @@ -0,0 +1,87 @@ +import type { DocumentLoader } from "./docloader.ts"; + +/** + * An object of a vocabulary class generated by `@fedify/vocab-tools`, such + * as `Note` or `Person` from `@fedify/vocab`. + * + * Every root class that `@fedify/vocab-tools` generates implements this + * interface, so it covers the classes of third-party vocabulary modules + * generated with the same tool as well. Only generated classes are meant to + * implement it: the `"~fedify.vocab"` brand keeps arbitrary objects with a + * `toJsonLd()` method from satisfying it by accident. + * + * @since 2.5.0 + */ +export interface VocabularyObject { + /** + * The brand that marks generated vocabulary objects. It is always `true`. + * Its name is a string rather than a symbol, so that objects generated + * against different copies of `@fedify/vocab-runtime` stay compatible with + * each other's type declarations. + */ + readonly "~fedify.vocab": true; + + /** + * The object's `@id`, or `null` if it has none. + */ + readonly id: URL | null; + + /** + * Converts this object to a JSON-LD structure. + * @param options The options to use. + * @returns The JSON-LD representation of this object. + */ + toJsonLd(options?: { + format?: "compact" | "expand"; + contextLoader?: DocumentLoader; + context?: + | string + | Record + | (string | Record)[]; + }): Promise; +} + +/** + * A value object in expanded JSON-LD, such as + * `{ "@value": "Hello", "@language": "en" }`. A JSON literal has + * `"@type": "@json"`, and its `@value` is the JSON value itself. + * @since 2.5.0 + */ +export interface RawValueObject { + readonly "@value": unknown; + readonly "@type"?: string; + readonly "@language"?: string; + readonly "@direction"?: "ltr" | "rtl"; + readonly "@index"?: string; +} + +/** + * A node object in expanded JSON-LD: a reference such as + * `{ "@id": "https://example.com/" }`, or an embedded node whose other keys + * are full property IRIs with arrays of {@link RawPropertyValue}s. + * A graph object, which has a `@graph` key, also takes this shape. + * @since 2.5.0 + */ +export interface RawNodeObject { + readonly "@id"?: string; + readonly "@type"?: readonly string[]; + readonly [key: string]: unknown; +} + +/** + * A list object in expanded JSON-LD, used for properties whose values are + * ordered, such as `{ "@list": [{ "@value": 1 }, { "@value": 2 }] }`. + * @since 2.5.0 + */ +export interface RawListObject { + readonly "@list": readonly RawPropertyValue[]; + readonly "@index"?: string; +} + +/** + * A single value of a property in expanded JSON-LD, as returned by the + * `getRawPropertyValues()` function generated by `@fedify/vocab-tools`. + * Narrow it with the `in` operator, e.g., `"@value" in value`. + * @since 2.5.0 + */ +export type RawPropertyValue = RawValueObject | RawNodeObject | RawListObject; diff --git a/packages/vocab-runtime/tsdown.config.ts b/packages/vocab-runtime/tsdown.config.ts index 49be94738..3939a22d5 100644 --- a/packages/vocab-runtime/tsdown.config.ts +++ b/packages/vocab-runtime/tsdown.config.ts @@ -9,6 +9,7 @@ export default [ "src/internal.ts", "src/internal/jsonld-cache.ts", "src/internal/portable-dereference.ts", + "src/internal/raw-property.ts", "src/internal/signed-representation.ts", "src/jsonld.ts", "src/temporal.ts", 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 9302bedc8..20b4de247 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap @@ -27,7 +27,9 @@ import { parseIri, parseJsonLdId, type PortableObjectVerifier, - type RemoteDocument + type RawPropertyValue, + type RemoteDocument, + type VocabularyObject } from \\"@fedify/vocab-runtime\\"; import { compactJsonLdCache, @@ -56,6 +58,16 @@ import { rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject } from \\"@fedify/vocab-runtime/internal/portable-dereference\\"; +import { + createRawPropertyEncodingOptions, + encodeNestedVocabularyValue, + expandRawPropertyValue, + RAW_PROPERTY_PROTOCOL, + type RawPropertyRequest, + readRawPropertyValues, + retainRawProperties, + type RetainedRawProperties +} from \\"@fedify/vocab-runtime/internal/raw-property\\"; import { enterSignedValueScope, resolveSignedValues, @@ -369,6 +381,289 @@ function deepCloneGraph(source: object, root: T): T { return root; } +type RawPropertyEncoder = ( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, +) => Promise; + +interface RawPropertyDescriptor { + readonly canonicalIri: string; + readonly encode: RawPropertyEncoder; +} + +// Unknown properties retained while decoding, keyed by the decoded object: +const retainedRawProperties = new WeakMap(); + +// Encoders of the properties each generated class declares, keyed by the +// class's prototype and then by the property IRIs, including aliases: +const rawPropertyDescriptors = new Map< + object, + ReadonlyMap +>(); + +function getRawPropertyDescriptor( + object: object, + iri: string, +): RawPropertyDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(object); + while (prototype != null) { + const descriptor = rawPropertyDescriptors.get(prototype)?.get(iri); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function copyRawProperties(source: object, destination: object): void { + const retained = retainedRawProperties.get(source); + if (retained == null) retainedRawProperties.delete(destination); + else retainedRawProperties.set(destination, retained); +} + +// The contexts in effect for the cached JSON-LD of embedded objects, which +// stays as it was received, keyed by the objects. Telling which keys of such +// a document are which properties takes the contexts of its parents as well: +const cachedJsonLdContexts = new WeakMap(); + +function getCachedJsonLdContext(object: object, context: unknown): unknown { + return cachedJsonLdContexts.has(object) + ? cachedJsonLdContexts.get(object) + : context; +} + +// Objects that were given the document they were received as: +const receivedJsonLd = new WeakSet(); + +// Gives an embedded object, decoded along with the whole document, the document +// it was received as, which toJsonLd() has to return as is, as a proof can +// cover it. The object is not decoded from that document, since an embedded +// document alone cannot rebuild what its parents' contexts contributed to it, +// such as type-scoped and property-scoped contexts: +function keepReceivedJsonLd( + object: unknown, + document: object, + parentContext: unknown, +): void { + if ( + object == null || typeof object !== \\"object\\" || + !(RAW_PROPERTY_PROTOCOL in object) || receivedJsonLd.has(object) + ) { + return; + } + receivedJsonLd.add(object); + (object as unknown as { _cachedJsonLd?: unknown })._cachedJsonLd = + structuredClone(document); + const own = (document as { \\"@context\\"?: unknown })[\\"@context\\"]; + cachedJsonLdContexts.set(object, [ + ...(globalThis.Array.isArray(parentContext) + ? parentContext + : [parentContext]), + ...(globalThis.Array.isArray(own) ? own : [own]), + ]); +} + +// The results of isCachedPropertyKey(), keyed by the document and then by the +// key: +const cachedPropertyKeys = new WeakMap>>(); + +async function expandTopLevelKeys( + document: Record, + contextLoader: DocumentLoader, +): Promise { + const expanded = await jsonld.expand(document, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + return globalThis.Object.keys(expanded[0] ?? {}).filter((iri) => + !iri.startsWith(\\"@\\") + ); +} + +// The number of expansions must not depend on the document, which can come +// from a remote peer, as each of them can load the contexts again: +async function mapsOnlyKeyToProperty( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + const own = await expandTopLevelKeys( + { \\"@context\\": context, [key]: [] }, + contextLoader, + ); + if (own.length !== 1 || own[0] !== iris[0]) return false; + // Only the keys matter, so nested values and their contexts are left out, + // while scalars stay for keyword aliases such as id, which require them: + const others: Record = { \\"@context\\": context }; + for (const [k, value] of globalThis.Object.entries(document)) { + if (k === key || k.startsWith(\\"@\\")) continue; + others[k] = value != null && typeof value === \\"object\\" ? [] : value; + } + try { + const expanded = await expandTopLevelKeys(others, contextLoader); + return !expanded.some((iri) => iris.includes(iri)); + } catch { + // Some other term could not take the placeholder, so nothing is known: + return false; + } +} + +// Whether the embedded documents under a key of a compacted document are the +// values decoded for a property. The document has to map the key, and no other +// key, to the property, as a context can remap the key or map another term to +// the property, in which case the cached documents cannot be matched with the +// decoded values: +async function isCachedPropertyKey( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + let checks = cachedPropertyKeys.get(document); + if (checks == null) { + checks = new Map(); + cachedPropertyKeys.set(document, checks); + } + const cached = checks.get(key); + if (cached != null) return await cached; + const check = mapsOnlyKeyToProperty( + document, + context, + key, + iris, + contextLoader, + ); + // A failure, such as of the context loader, is not remembered, as another + // call can pass another loader: + const map = checks; + check.catch(() => map.delete(key)); + checks.set(key, check); + return await check; +} + +async function readRawProperty( + object: object, + request: RawPropertyRequest, + contextLoader: DocumentLoader, +): Promise { + const retained = retainedRawProperties.get(object); + for (const iri of request.candidates) { + const descriptor = getRawPropertyDescriptor(object, iri); + if (descriptor != null) { + const value = await descriptor.encode( + object, + createRawPropertyEncodingOptions(request.stack, contextLoader), + ); + return value === undefined ? [] : await expandRawPropertyValue( + descriptor.canonicalIri, + value, + contextLoader, + ); + } + if (retained != null && globalThis.Object.hasOwn(retained, iri)) { + return retained[iri]; + } + } + return []; +} + +/** + * Gets the values of a property of a vocabulary object in expanded JSON-LD, + * looking the property up by its full IRI. This works for properties that + * have no typed accessor as well as for those that do. + * + * *Raw* means untyped expanded JSON-LD values, such as + * \`{ \\"@value\\": \\"Hello\\" }\` or \`{ \\"@id\\": \\"https://example.com/\\" }\`, as + * opposed to the values that typed accessors return. It does not mean the + * received document: + * + * - For a property that the object's class has no accessor for, the result + * is the values retained when the object was decoded by \`fromJsonLd()\`. + * Objects constructed locally have none. + * - For a property that the class has an accessor for, including a + * redundant alias of such a property, the result is the current typed + * values encoded back into expanded JSON-LD. It reflects \`clone()\` + * replacements and objects fetched by dereferencing accessors, and it can + * differ from the received values: for example, values that failed to + * decode are missing, and lexical forms such as date-times are + * normalized. When a later release adds an accessor for a property, + * the result for that property switches from the retained values to the + * encoded ones. + * + * The values are not verified in any way, and IRIs in them are never + * dereferenced. Validate them before use, as with any other data received + * from a remote server. The result is a deep copy, so modifying it does not + * affect the object. + * + * The IRI is matched as given, and then as normalized by the WHATWG URL + * parser. Prefixes are never expanded: \`\\"as:content\\"\` is a valid IRI with + * the \`as:\` scheme, so it normally matches nothing. An IRI whose scheme is + * not \`http:\` or \`https:\` is therefore logged as a warning under the + * \`[\\"fedify\\", \\"vocab\\"]\` category. + * + * \`\`\`typescript ignore + * const values = await getRawPropertyValues( + * note, + * \\"https://w3id.org/quantpub#structuredUrl\\", + * ); + * for (const value of values) { + * if (\\"@id\\" in value && typeof value[\\"@id\\"] === \\"string\\") { + * console.log(new URL(value[\\"@id\\"])); + * } + * } + * \`\`\` + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The values of the property, or an empty array if it has none. + * @throws {TypeError} If \`propertyIri\` is not an absolute IRI, e.g., an + * empty string, a JSON-LD keyword such as \`\\"@id\\"\`, a + * blank node identifier, a term, or a relative + * reference; if \`object\` is not a generated vocabulary + * object; or if encoding the values of a known property + * meets a cycle of objects. + * @since 2.5.0 + */ +export function getRawPropertyValues( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + return readRawPropertyValues(object, propertyIri, \\"getRawPropertyValues\\"); +} + +/** + * Gets the first value of a property of a vocabulary object in expanded + * JSON-LD, looking the property up by its full IRI. It is equivalent to + * \`(await getRawPropertyValues(object, propertyIri))[0] ?? null\`; see + * {@link getRawPropertyValues} for how the values are obtained. + * + * It does not throw when the property has multiple values. JSON-LD does not + * order the values of a property unless it is a list, so the first value is + * not more significant than the others. A list property has a single value, + * the \`{ \\"@list\\": [...] }\` object. + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The first value of the property, or \`null\` if it has none. + * @throws {TypeError} In the same cases as {@link getRawPropertyValues}. + * @since 2.5.0 + */ +export async function getRawPropertyValue( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + const values = await readRawPropertyValues( + object, + propertyIri, + \\"getRawPropertyValue\\", + ); + return values[0] ?? null; +} + function isValidLanguageTag(language: string): boolean { try { new Intl.Locale(normalizeLanguageTag(language)); @@ -451,7 +746,7 @@ import * as _ppM0 from \\"./preprocessors.ts\\"; * {@link OrderedCollection}. * */ -export class Object { +export class Object implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -467,6 +762,14 @@ export class Object { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -2132,6 +2435,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -2187,6 +2494,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length < vocabSparseArrayMinimumLength ? this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice() : vocabCopyPropertyArray(this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment);clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = vocabCopyTrustSet( this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, @@ -3771,9 +4079,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -4483,6 +4792,1263 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Object, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#attachment\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#attachment\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#attributedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#attributedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#audience\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#audience\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#content\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#content\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#context\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#context\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#name\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#name\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endTime\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endTime\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#generator\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#generator\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#icon\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#icon\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#image\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#image\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#inReplyTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#inReplyTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#location\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#location\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preview\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preview\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#published\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#published\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#replies\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_7UpwM3JWcXhADcscukEehBorf6k_replies) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#replies\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#shares\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#shares\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#likes\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#likes\\", descriptor); + + descriptor = { + canonicalIri: \\"http://fedibird.com/ns#emojiReactions\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://fedibird.com/ns#emojiReactions\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#startTime\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#startTime\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#summary\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#summary\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#tag\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#tag\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#updated\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#updated\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#url\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + + let element = ( +v instanceof URL ?{ \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#url\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#to\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#to\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#bto\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#bto\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#cc\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#cc\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#bcc\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#bcc\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#mediaType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#mediaType\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#duration\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#duration\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#duration\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#sensitive\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#sensitive\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#source\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#source\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#proof\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push({ \\"@graph\\": element }); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#proof\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionPolicy\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionPolicy\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#approvedBy\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#approvedBy\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#likeAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#likeAuthorization\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#replyAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#replyAuthorization\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#announceAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#announceAuthorization\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/22cd#translations\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/22cd#translations\\", descriptor); + + descriptor = { + canonicalIri: \\"http://purl.org/dc/terms/license\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://purl.org/dc/terms/license\\", descriptor); +descriptors.set(\\"https://schema.org/license\\", descriptor); +descriptors.set(\\"http://creativecommons.org/ns#license\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchAttachment( url: URL, @@ -4886,18 +6452,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#attachment_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"attachment\\", + [\\"https://www.w3.org/ns/activitystreams#attachment\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -5369,18 +6939,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#attribution_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"attributedTo\\", + [\\"https://www.w3.org/ns/activitystreams#attributedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -5533,18 +7107,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#attribution_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"attributedTo\\", + [\\"https://www.w3.org/ns/activitystreams#attributedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -5955,18 +7533,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#audience_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"audience\\", + [\\"https://www.w3.org/ns/activitystreams#audience\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -6118,18 +7700,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#audience_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"audience\\", + [\\"https://www.w3.org/ns/activitystreams#audience\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -6593,18 +8179,22 @@ get contents(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#context_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"context\\", + [\\"https://www.w3.org/ns/activitystreams#context\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -7075,18 +8665,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#generator_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"generator\\", + [\\"https://www.w3.org/ns/activitystreams#generator\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -7520,18 +9114,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#icon_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"icon\\", + [\\"https://www.w3.org/ns/activitystreams#icon\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -7684,18 +9282,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#icon_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"icon\\", + [\\"https://www.w3.org/ns/activitystreams#icon\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8129,18 +9731,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#image_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"image\\", + [\\"https://www.w3.org/ns/activitystreams#image\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8293,18 +9899,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#image_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"image\\", + [\\"https://www.w3.org/ns/activitystreams#image\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8730,18 +10340,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#replyTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inReplyTo\\", + [\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8893,18 +10507,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#replyTarget_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inReplyTo\\", + [\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -9330,18 +10948,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#location_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"location\\", + [\\"https://www.w3.org/ns/activitystreams#location\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -9493,18 +11115,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#location_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"location\\", + [\\"https://www.w3.org/ns/activitystreams#location\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -9929,18 +11555,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#preview_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"preview\\", + [\\"https://www.w3.org/ns/activitystreams#preview\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -10091,18 +11721,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#preview_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"preview\\", + [\\"https://www.w3.org/ns/activitystreams#preview\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -10526,18 +12160,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#replies_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"replies\\", + [\\"https://www.w3.org/ns/activitystreams#replies\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -10953,18 +12591,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#shares_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"shares\\", + [\\"https://www.w3.org/ns/activitystreams#shares\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -11380,18 +13022,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likes_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likes\\", + [\\"https://www.w3.org/ns/activitystreams#likes\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -11801,18 +13447,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#emojiReactions_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"emojiReactions\\", + [\\"http://fedibird.com/ns#emojiReactions\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -12283,18 +13933,22 @@ get summaries(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#tag_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"tag\\", + [\\"https://www.w3.org/ns/activitystreams#tag\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -12739,18 +14393,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#to_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"to\\", + [\\"https://www.w3.org/ns/activitystreams#to\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -12902,18 +14560,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#to_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"to\\", + [\\"https://www.w3.org/ns/activitystreams#to\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -13324,18 +14986,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#bto_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bto\\", + [\\"https://www.w3.org/ns/activitystreams#bto\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -13487,18 +15153,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#bto_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bto\\", + [\\"https://www.w3.org/ns/activitystreams#bto\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -13909,18 +15579,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#cc_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"cc\\", + [\\"https://www.w3.org/ns/activitystreams#cc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -14072,18 +15746,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#cc_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"cc\\", + [\\"https://www.w3.org/ns/activitystreams#cc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -14494,18 +16172,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#bcc_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bcc\\", + [\\"https://www.w3.org/ns/activitystreams#bcc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -14657,18 +16339,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#bcc_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bcc\\", + [\\"https://www.w3.org/ns/activitystreams#bcc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -15142,18 +16828,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#proof_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"proof\\", + [\\"https://w3id.org/security#proof\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -15304,18 +16994,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#proof_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"proof\\", + [\\"https://w3id.org/security#proof\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -15765,18 +17459,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likeAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likeAuthorization\\", + [\\"https://gotosocial.org/ns#likeAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -16186,18 +17884,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#replyAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"replyAuthorization\\", + [\\"https://gotosocial.org/ns#replyAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -16607,18 +18309,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#announceAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"announceAuthorization\\", + [\\"https://gotosocial.org/ns#announceAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -17536,8 +19242,21 @@ get licenses(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17556,8 +19275,29 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17576,8 +19316,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17596,6 +19341,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -17619,8 +19365,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17639,6 +19394,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -17662,6 +19418,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17685,8 +19442,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17705,8 +19471,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17725,8 +19496,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17745,8 +19521,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17765,8 +19550,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17785,8 +19579,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17805,6 +19608,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17828,8 +19632,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_7UpwM3JWcXhADcscukEehBorf6k_replies) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17848,8 +19657,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17868,8 +19682,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17888,8 +19707,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17908,6 +19732,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17931,6 +19756,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -17954,8 +19780,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17974,6 +19809,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17997,8 +19833,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + let element = ( - v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options) + v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18017,8 +19858,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18037,8 +19883,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18057,8 +19908,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18077,8 +19933,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18097,6 +19958,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { \\"@value\\": v } ); @@ -18117,6 +19979,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#duration\\", @@ -18140,6 +20003,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { + let element = ( { \\"@value\\": v } ); @@ -18160,8 +20024,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18180,8 +20049,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18200,8 +20074,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18220,6 +20099,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -18240,8 +20120,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18260,8 +20145,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18280,8 +20170,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18300,8 +20195,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18320,6 +20220,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -18441,6 +20342,8 @@ get licenses(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -18874,16 +20777,31 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\") ? await PropertyValue.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -18925,23 +20843,48 @@ get licenses(): (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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -18982,7 +20925,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19058,12 +21006,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19172,12 +21130,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19241,7 +21209,12 @@ get licenses(): (URL)[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19305,7 +21278,12 @@ get licenses(): (URL)[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19348,12 +21326,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19396,12 +21384,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19444,12 +21442,22 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19523,7 +21531,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19564,7 +21577,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19605,7 +21623,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19646,7 +21669,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19755,12 +21783,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19829,7 +21867,12 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19870,7 +21913,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19911,7 +21959,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19952,7 +22005,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19993,7 +22051,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20113,7 +22176,12 @@ get licenses(): (URL)[] { const decoded = await Source.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20159,7 +22227,12 @@ get licenses(): (URL)[] { const decoded = await DataIntegrityProof.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20191,7 +22264,12 @@ get licenses(): (URL)[] { const decoded = await InteractionPolicy.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20261,7 +22339,12 @@ get licenses(): (URL)[] { const decoded = await LikeAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20302,7 +22385,12 @@ get licenses(): (URL)[] { const decoded = await ReplyAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20343,7 +22431,12 @@ get licenses(): (URL)[] { const decoded = await AnnounceAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20375,7 +22468,12 @@ get licenses(): (URL)[] { const decoded = await Translation.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20429,6 +22527,16 @@ get licenses(): (URL)[] { } instance.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = _2rzkBRS4gNPrkJk9DohHAMUAxA2d; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Object.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -21453,6 +23561,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -21518,9 +23630,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -21708,6 +23821,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -21840,6 +23955,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Emoji)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -21847,6 +23965,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Emoji.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -22019,6 +24147,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -22132,9 +24264,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -22262,6 +24395,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -22631,18 +24861,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -23075,18 +25309,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -23262,8 +25500,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -23282,6 +25525,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -23306,8 +25550,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -23392,6 +25641,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -23524,6 +25775,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ChatMessage)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -23555,7 +25809,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -23635,7 +25894,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -23652,6 +25916,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ChatMessage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -24234,6 +26508,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -24707,9 +26985,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -24909,6 +27188,214 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#actor\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#actor\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#object\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#object\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#target\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#target\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#result\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#result\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#origin\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#origin\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#instrument\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#instrument\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchActor( url: URL, @@ -25338,18 +27825,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#actor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"actor\\", + [\\"https://www.w3.org/ns/activitystreams#actor\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -25502,18 +27993,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#actor_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"actor\\", + [\\"https://www.w3.org/ns/activitystreams#actor\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -25925,18 +28420,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#object_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -26089,18 +28588,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#object_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -26515,18 +29018,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#target_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"target\\", + [\\"https://www.w3.org/ns/activitystreams#target\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -26682,18 +29189,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#target_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"target\\", + [\\"https://www.w3.org/ns/activitystreams#target\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27105,18 +29616,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#result_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"result\\", + [\\"https://www.w3.org/ns/activitystreams#result\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27269,18 +29784,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#result_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"result\\", + [\\"https://www.w3.org/ns/activitystreams#result\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27693,18 +30212,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#origin_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"origin\\", + [\\"https://www.w3.org/ns/activitystreams#origin\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27858,18 +30381,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#origin_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"origin\\", + [\\"https://www.w3.org/ns/activitystreams#origin\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -28280,18 +30807,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#instrument_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"instrument\\", + [\\"https://www.w3.org/ns/activitystreams#instrument\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -28443,18 +30974,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#instrument_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"instrument\\", + [\\"https://www.w3.org/ns/activitystreams#instrument\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -28546,8 +31081,29 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28566,8 +31122,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28586,8 +31147,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28606,8 +31172,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28626,8 +31197,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28646,8 +31222,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28732,6 +31313,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -29004,6 +31587,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Activity)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -29036,23 +31622,48 @@ const base = getDeepCloneDescriptor(this.prototype)!; 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -29093,7 +31704,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29134,7 +31750,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29175,7 +31796,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29216,7 +31842,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29257,7 +31888,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29274,6 +31910,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Activity.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -29558,6 +32204,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -29629,9 +32279,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -29806,6 +32457,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -29938,6 +32591,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof EmojiReact)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -29945,6 +32601,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + EmojiReact.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -30005,7 +32671,7 @@ instruments?: (Object | URL)[];} }; /** A pair of property name and value. */ -export class PropertyValue { +export class PropertyValue implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -30021,6 +32687,14 @@ export class PropertyValue { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -30166,6 +32840,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -30205,6 +32883,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { @@ -30250,9 +32929,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -30308,6 +32988,88 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: PropertyValue, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#name\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as PropertyValue).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#name\\", descriptor); + + descriptor = { + canonicalIri: \\"http://schema.org#value\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as PropertyValue).#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://schema.org#value\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The name of a property. */ @@ -30424,6 +33186,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -30447,6 +33210,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -30535,6 +33299,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://schema.org#value\\",\\"https://www.w3.org/ns/activitystreams#name\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -30736,6 +33502,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + PropertyValue.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -30851,7 +33627,7 @@ deepCloneDescriptors.set(this.prototype, { }; /** A quantity with a unit of measure. */ -export class Measure { +export class Measure implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -30867,6 +33643,14 @@ export class Measure { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -31012,6 +33796,10 @@ unit?: string | null;numericalValue?: Decimal | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -31051,6 +33839,7 @@ unit?: string | null;numericalValue?: Decimal | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < vocabSparseArrayMinimumLength ? this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice() : vocabCopyPropertyArray(this.#_27fgyFbosTtMAhuepJH8K3ZGURT6); if (\\"unit\\" in values && values.unit != null) { @@ -31096,9 +33885,10 @@ unit?: string | null;numericalValue?: Decimal | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -31154,6 +33944,85 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Measure, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Measure).#_27fgyFbosTtMAhuepJH8K3ZGURT6) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Measure).#_1GQx8o2RgxRs4x9G5uT39XYBv7D) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#decimal\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The name of the unit, according to the Ontology of units of Measure * classification. The recommended unit for countable items is \`\\"one\\"\`. @@ -31268,6 +34137,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) { + let element = ( { \\"@value\\": v } ); @@ -31288,6 +34158,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#decimal\\", @@ -31366,6 +34237,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue\\",\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -31560,6 +34433,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = _1GQx8o2RgxRs4x9G5uT39XYBv7D; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Measure.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -31777,6 +34660,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -31876,9 +34763,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -31984,6 +34872,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as AnnounceAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as AnnounceAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -32352,18 +35308,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -32772,18 +35732,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -32933,8 +35897,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -32953,8 +35922,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -33039,6 +36013,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -33171,6 +36147,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof AnnounceAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -33202,7 +36181,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -33243,7 +36227,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -33260,6 +36249,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + AnnounceAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -33438,6 +36437,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -33509,9 +36512,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -33686,6 +36690,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -33818,6 +36824,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof AnnounceRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -33825,6 +36834,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + AnnounceRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -33892,7 +36911,7 @@ instruments?: (Object | URL)[];} * for details. * */ -export class InteractionPolicy { +export class InteractionPolicy implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -33908,6 +36927,14 @@ export class InteractionPolicy { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -34095,6 +37122,10 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -34134,6 +37165,7 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length < vocabSparseArrayMinimumLength ? this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice() : vocabCopyPropertyArray(this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature); if (\\"canFeature\\" in values && values.canFeature != null) { @@ -34221,9 +37253,10 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -34389,6 +37422,183 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: InteractionPolicy, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#canFeature\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#canFeature\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canLike\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canLike\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canReply\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canReply\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canAnnounce\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canAnnounce\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canQuote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canQuote\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The sub-policy specifying who can feature the actor in a * {@link FeaturedCollection}. @@ -34513,8 +37723,13 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34533,8 +37748,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34553,8 +37773,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34573,8 +37798,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34593,8 +37823,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34693,6 +37928,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://gotosocial.org/ns#canAnnounce\\",\\"https://gotosocial.org/ns#canLike\\",\\"https://gotosocial.org/ns#canQuote\\",\\"https://gotosocial.org/ns#canReply\\",\\"https://w3id.org/fep/7aa9#canFeature\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -34843,7 +38080,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34875,7 +38117,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34907,7 +38154,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34939,7 +38191,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34971,7 +38228,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34988,6 +38250,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = _LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + InteractionPolicy.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -35181,7 +38453,7 @@ deepCloneDescriptors.set(this.prototype, { * for details. * */ -export class InteractionRule { +export class InteractionRule implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -35197,6 +38469,14 @@ export class InteractionRule { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -35438,6 +38718,10 @@ manualApprovals?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -35479,6 +38763,7 @@ manualApprovals?: (URL)[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < vocabSparseArrayMinimumLength ? this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice() : vocabCopyPropertyArray(this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval); if (\\"automaticApproval\\" in values && values.automaticApproval != null) { @@ -35618,9 +38903,10 @@ manualApprovals?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -35722,6 +39008,82 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: InteractionRule, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#automaticApproval\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionRule).#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#automaticApproval\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#manualApproval\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionRule).#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#manualApproval\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** URIs of actors or collections whose interactions are automatically * approved without requiring manual review by the post author. @@ -35809,6 +39171,7 @@ get manualApprovals(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -35829,6 +39192,7 @@ get manualApprovals(): (URL)[] { array = []; for (const v of this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -35904,6 +39268,8 @@ get manualApprovals(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://gotosocial.org/ns#automaticApproval\\",\\"https://gotosocial.org/ns#manualApproval\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -36097,6 +39463,16 @@ get manualApprovals(): (URL)[] { } instance.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + InteractionRule.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -36325,6 +39701,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -36424,9 +39804,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -36532,6 +39913,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as LikeAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as LikeAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -36900,18 +40349,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -37320,18 +40773,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -37481,8 +40938,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -37501,8 +40963,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -37587,6 +41054,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -37719,6 +41188,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof LikeAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -37750,7 +41222,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -37791,7 +41268,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -37808,6 +41290,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + LikeAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -37985,6 +41477,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -38056,9 +41552,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -38233,6 +41730,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -38365,6 +41864,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof LikeRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -38372,6 +41874,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + LikeRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -38533,6 +42045,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -38632,9 +42148,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -38740,6 +42257,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ReplyAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ReplyAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -39108,18 +42693,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -39528,18 +43117,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -39689,8 +43282,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -39709,8 +43307,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -39795,6 +43398,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -39927,6 +43532,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ReplyAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -39958,7 +43566,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -39999,7 +43612,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -40016,6 +43634,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ReplyAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -40193,6 +43821,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -40264,9 +43896,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -40441,6 +44074,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -40573,6 +44208,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ReplyRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -40580,6 +44218,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ReplyRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -40741,6 +44389,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -40840,9 +44492,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -40948,6 +44601,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as QuoteAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as QuoteAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -41315,18 +45036,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -41735,18 +45460,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -41896,8 +45625,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -41916,8 +45650,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -42002,6 +45741,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -42134,6 +45875,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof QuoteAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -42165,7 +45909,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -42206,7 +45955,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -42223,6 +45977,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + QuoteAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -42400,6 +46164,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -42471,9 +46239,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -42648,6 +46417,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -42780,6 +46551,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof QuoteRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -42787,6 +46561,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + QuoteRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -42854,7 +46638,7 @@ instruments?: (Object | URL)[];} * Targets [draft revision 6d0d6559](https://codeberg.org/fediverse/fep/src/commit/6d0d6559054baeb7b71a5f2bdc14fc4c09b66f39/fep/22cd/fep-22cd.md). * */ -export class Translation { +export class Translation implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -42870,6 +46654,14 @@ export class Translation { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -43171,6 +46963,10 @@ urls?: ((URL | Link))[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -43212,6 +47008,7 @@ urls?: ((URL | Link))[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < vocabSparseArrayMinimumLength ? this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice() : vocabCopyPropertyArray(this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG); if (\\"language\\" in values && values.language != null) { @@ -43413,9 +47210,10 @@ urls?: ((URL | Link))[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -43561,6 +47359,217 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Translation, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://schema.org/inLanguage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) { + + let element = ( +{ \\"@value\\": v.baseName } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/inLanguage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://schema.org/translator\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/translator\\", descriptor); + + descriptor = { + canonicalIri: \\"https://schema.org/translationOfWork\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/translationOfWork\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/22cd#sourceUpdated\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/22cd#sourceUpdated\\", descriptor); + + descriptor = { + canonicalIri: \\"https://schema.org/isBasedOn\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/isBasedOn\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#url\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + + let element = ( +v instanceof URL ?{ \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#url\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The translated language. Publishers must match a language in the * containing object's content, name, or summary map. @@ -44008,18 +48017,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#translator_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"translator\\", + [\\"https://schema.org/translator\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -44175,18 +48188,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#translator_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"translator\\", + [\\"https://schema.org/translator\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -44469,6 +48486,7 @@ get urls(): ((URL | Link))[] { const values: Record = {}; array = []; for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) { + let element = ( { \\"@value\\": v.baseName } ); @@ -44489,8 +48507,29 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -44509,6 +48548,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -44529,6 +48569,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -44552,6 +48593,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -44572,8 +48614,13 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + let element = ( - v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options) + v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -44652,6 +48699,8 @@ get urls(): ((URL | Link))[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://schema.org/inLanguage\\",\\"https://schema.org/isBasedOn\\",\\"https://schema.org/translationOfWork\\",\\"https://schema.org/translator\\",\\"https://w3id.org/fep/22cd#sourceUpdated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -44841,23 +48890,48 @@ 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -44984,7 +49058,12 @@ 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -45001,6 +49080,16 @@ get urls(): ((URL | Link))[] { } instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Translation.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -45305,6 +49394,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -45404,9 +49497,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -45512,6 +49606,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeatureAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeatureAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -45878,18 +50040,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -46297,18 +50463,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -46458,8 +50628,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -46478,8 +50653,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -46564,6 +50744,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -46696,6 +50878,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeatureAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -46727,7 +50912,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -46768,7 +50958,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -46785,6 +50980,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeatureAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -46959,6 +51164,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -47030,9 +51239,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -47207,6 +51417,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -47339,6 +51551,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeatureRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -47346,6 +51561,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeatureRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -47706,6 +51931,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -48017,9 +52246,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -48345,6 +52575,418 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#totalItems\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#totalItems\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#current\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3UyUdxnyn6cDn53QKrh4MBiearma_current) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#current\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#first\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_J52RqweMe6hhv7RnLJMC8BExTE5_first) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#first\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#last\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#last\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#items\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#items\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#likesOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#likesOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#sharesOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#sharesOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#repliesOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#repliesOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#inboxOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#inboxOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#outboxOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#outboxOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#followersOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#followersOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#followingOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#followingOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#likedOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#likedOf\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A non-negative integer specifying the total number of objects contained by * the logical view of the collection. This number might not reflect the actual @@ -48729,18 +53371,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#current_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"current\\", + [\\"https://www.w3.org/ns/activitystreams#current\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -49150,18 +53796,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#first_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"first\\", + [\\"https://www.w3.org/ns/activitystreams#first\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -49571,18 +54221,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#last_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"last\\", + [\\"https://www.w3.org/ns/activitystreams#last\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -50011,18 +54665,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"items\\", + [\\"https://www.w3.org/ns/activitystreams#items\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -50432,18 +55090,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likesOf\\", + [\\"https://w3id.org/fep/5711#likesOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -50852,18 +55514,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#sharesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"sharesOf\\", + [\\"https://w3id.org/fep/5711#sharesOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -51272,18 +55938,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#repliesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"repliesOf\\", + [\\"https://w3id.org/fep/5711#repliesOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -51692,18 +56362,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inboxOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inboxOf\\", + [\\"https://w3id.org/fep/5711#inboxOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -52112,18 +56786,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outboxOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outboxOf\\", + [\\"https://w3id.org/fep/5711#outboxOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -52532,18 +57210,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followersOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followersOf\\", + [\\"https://w3id.org/fep/5711#followersOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -52952,18 +57634,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followingOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followingOf\\", + [\\"https://w3id.org/fep/5711#followingOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -53372,18 +58058,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likedOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likedOf\\", + [\\"https://w3id.org/fep/5711#likedOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -53753,6 +58443,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -53776,8 +58467,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53796,8 +58492,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53816,8 +58517,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53836,8 +58542,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53856,8 +58571,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53876,8 +58596,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53896,8 +58621,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53916,8 +58646,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53936,8 +58671,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53956,8 +58696,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53976,8 +58721,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53996,8 +58746,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -54082,6 +58837,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -54230,6 +58987,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Collection)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -54290,7 +59050,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54331,7 +59096,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54372,7 +59142,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54415,12 +59190,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -54461,7 +59246,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54502,7 +59292,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54543,7 +59338,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54584,7 +59384,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54625,7 +59430,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54666,7 +59476,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54707,7 +59522,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54748,7 +59568,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54765,6 +59590,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Collection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -55194,6 +60029,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -55304,9 +60143,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -55390,6 +60230,47 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#items\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollection).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#items\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchItem( url: URL, @@ -55777,18 +60658,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"orderedItems\\", + [\\"https://www.w3.org/ns/activitystreams#items\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -55920,8 +60805,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -56006,6 +60900,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -56142,6 +61038,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof OrderedCollection)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -56175,12 +61074,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -56197,6 +61106,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + OrderedCollection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -56371,6 +61290,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -56464,9 +61387,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -56550,6 +61474,70 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#topic\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedCollection).#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#topic\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedCollection).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A single {@link Hashtag} object that represents the main topic or category * of this featured collection. @@ -56685,8 +61673,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -56705,6 +61698,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -56791,6 +61785,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/fep/7aa9#topic\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -56923,6 +61919,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeaturedCollection)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -56945,7 +61944,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Hashtag.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -56991,6 +61995,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeaturedCollection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -57187,6 +62201,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -57286,9 +62304,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -57394,6 +62413,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedItem).#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featureAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedItem).#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featureAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchFeaturedObject( url: URL, @@ -57760,18 +62847,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredObject\\", + [\\"https://w3id.org/fep/7aa9#featuredObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -58181,18 +63272,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featureAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featureAuthorization\\", + [\\"https://w3id.org/fep/7aa9#featureAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -58342,8 +63437,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -58362,8 +63462,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -58448,6 +63553,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/7aa9#featureAuthorization\\",\\"https://w3id.org/fep/7aa9#featuredObject\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -58580,6 +63687,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeaturedItem)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -58611,7 +63721,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -58652,7 +63767,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await FeatureAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -58669,6 +63789,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeaturedItem.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -58773,7 +63903,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; * and verifiable credential repository services. * */ -export class DidService { +export class DidService implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -58789,6 +63919,14 @@ export class DidService { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -58968,6 +64106,10 @@ endpoints?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -59008,6 +64150,7 @@ endpoints?: (URL)[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < vocabSparseArrayMinimumLength ? this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice() : vocabCopyPropertyArray(this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint); if (\\"endpoint\\" in values && values.endpoint != null) { @@ -59086,9 +64229,10 @@ endpoints?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -59167,6 +64311,55 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: DidService, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#serviceEndpoint\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DidService).#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#serviceEndpoint\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A network address, such as an HTTP URL, at which services operate on behalf * of a DID subject. @@ -59229,6 +64422,7 @@ get endpoints(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -59304,6 +64498,8 @@ get endpoints(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/did#serviceEndpoint\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -59472,6 +64668,16 @@ get endpoints(): (URL)[] { } instance.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + DidService.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -59620,6 +64826,10 @@ endpoints?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -59670,9 +64880,10 @@ endpoints?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -59815,6 +65026,8 @@ endpoints?: (URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/did#serviceEndpoint\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -59947,6 +65160,9 @@ endpoints?: (URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Export)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -59954,6 +65170,16 @@ endpoints?: (URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Export.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -60016,7 +65242,7 @@ endpoints?: (URL)[];} * verify the identity of the actor and the integrity of the data. * */ -export class DataIntegrityProof { +export class DataIntegrityProof implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -60032,6 +65258,14 @@ export class DataIntegrityProof { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -60223,6 +65457,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -60262,6 +65500,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < vocabSparseArrayMinimumLength ? this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice() : vocabCopyPropertyArray(this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite); if (\\"cryptosuite\\" in values && values.cryptosuite != null) { @@ -60354,9 +65593,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -60456,6 +65696,175 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: DataIntegrityProof, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/security#cryptosuite\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#cryptosuite\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#verificationMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#verificationMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#proofPurpose\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { + + let element = ( +{ + \\"@id\\": \\"https://w3id.org/security#\\" + v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#proofPurpose\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#proofValue\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { + + let element = ( +{ + \\"@type\\": \\"https://w3id.org/security#multibase\\", + \\"@value\\": new TextDecoder().decode(encodeMultibase(\\"base58btc\\", v)), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#proofValue\\", descriptor); + + descriptor = { + canonicalIri: \\"http://purl.org/dc/terms/created\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://purl.org/dc/terms/created\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The cryptographic suite used to create the proof. * @@ -60944,6 +66353,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { + let element = ( { \\"@value\\": v } ); @@ -60964,8 +66374,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -60984,6 +66399,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { + let element = ( { \\"@id\\": \\"https://w3id.org/security#\\" + v, @@ -61006,6 +66422,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { + let element = ( { \\"@type\\": \\"https://w3id.org/security#multibase\\", @@ -61029,6 +66446,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -61107,6 +66525,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://purl.org/dc/terms/created\\",\\"https://w3id.org/security#cryptosuite\\",\\"https://w3id.org/security#proofPurpose\\",\\"https://w3id.org/security#proofValue\\",\\"https://w3id.org/security#verificationMethod\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -61295,7 +66715,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -61403,6 +66828,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = _3qzP3ukEZoUziK5FEiA1RhU4aqac; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + DataIntegrityProof.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -61578,7 +67013,7 @@ deepCloneDescriptors.set(this.prototype, { }; /** A key owned by an actor. */ -export class CryptographicKey { +export class CryptographicKey implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -61594,6 +67029,14 @@ export class CryptographicKey { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -61744,6 +67187,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -61783,6 +67230,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < vocabSparseArrayMinimumLength ? this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice() : vocabCopyPropertyArray(this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner);clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = vocabCopyTrustSet( this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, @@ -61834,9 +67282,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -61914,6 +67363,102 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: CryptographicKey, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/security#owner\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CryptographicKey).#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#owner\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKeyPem\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CryptographicKey).#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { + + let element = ( +{ \\"@value\\": await exportSpki(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKeyPem\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchOwner( url: URL, @@ -62340,18 +67885,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#owner_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"owner\\", + [\\"https://w3id.org/security#owner\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -62510,8 +68059,29 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -62530,6 +68100,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { + let element = ( { \\"@value\\": await exportSpki(v) } ); @@ -62605,6 +68176,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/security#owner\\",\\"https://w3id.org/security#publicKeyPem\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -62765,23 +68338,48 @@ deepCloneDescriptors.set(this.prototype, { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -62827,6 +68425,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + CryptographicKey.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -62946,7 +68554,7 @@ deepCloneDescriptors.set(this.prototype, { * [1]: https://w3id.org/fep/521a * */ -export class Multikey { +export class Multikey implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -62962,6 +68570,14 @@ export class Multikey { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -63112,6 +68728,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -63151,6 +68771,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < vocabSparseArrayMinimumLength ? this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice() : vocabCopyPropertyArray(this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller);clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = vocabCopyTrustSet( this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, @@ -63202,9 +68823,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -63282,6 +68904,105 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Multikey, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/security#controller\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Multikey).#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#controller\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKeyMultibase\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Multikey).#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { + + let element = ( +{ + \\"@type\\": \\"https://w3id.org/security#multibase\\", + \\"@value\\": await exportMultibaseKey(v), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKeyMultibase\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchController( url: URL, @@ -63708,18 +69429,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#controller_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"controller\\", + [\\"https://w3id.org/security#controller\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -63882,8 +69607,29 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -63902,6 +69648,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { + let element = ( { \\"@type\\": \\"https://w3id.org/security#multibase\\", @@ -63980,6 +69727,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/security#controller\\",\\"https://w3id.org/security#publicKeyMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -64140,23 +69889,48 @@ deepCloneDescriptors.set(this.prototype, { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -64202,6 +69976,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Multikey.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -64418,6 +70202,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -64511,9 +70299,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -64619,6 +70408,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#stipulates\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Agreement).#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#stipulates\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#stipulatesReciprocal\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Agreement).#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#stipulatesReciprocal\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The primary {@link Commitment} associated with the agreement. This * commitment satisfies the primary {@link Intent} of the corresponding @@ -64759,8 +70616,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -64779,8 +70641,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -64865,6 +70732,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/valueflows/ont/vf#stipulates\\",\\"https://w3id.org/valueflows/ont/vf#stipulatesReciprocal\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -64997,6 +70866,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Agreement)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -65019,7 +70891,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Commitment.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65051,7 +70928,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Commitment.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65068,6 +70950,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = _4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Agreement.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -65172,7 +71064,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; * specifies the actual amount of the economic resource being committed. * */ -export class Commitment { +export class Commitment implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -65188,6 +71080,14 @@ export class Commitment { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -65333,6 +71233,10 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -65372,6 +71276,7 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length < vocabSparseArrayMinimumLength ? this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice() : vocabCopyPropertyArray(this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies); if (\\"satisfies\\" in values && values.satisfies != null) { @@ -65417,9 +71322,10 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -65519,6 +71425,86 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Commitment, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#satisfies\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Commitment).#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#satisfies\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Commitment).#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The {@link Intent} of a {@link Proposal} that this commitment * satisfies. The value is the proposal's URI with a @@ -65641,6 +71627,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -65661,8 +71648,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -65736,6 +71728,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\",\\"https://w3id.org/valueflows/ont/vf#satisfies\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -65915,7 +71909,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65932,6 +71931,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Commitment.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -66049,7 +72058,7 @@ deepCloneDescriptors.set(this.prototype, { * in a {@link Proposal}. * */ -export class Intent { +export class Intent implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -66065,6 +72074,14 @@ export class Intent { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -66252,6 +72269,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -66291,6 +72312,7 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < vocabSparseArrayMinimumLength ? this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice() : vocabCopyPropertyArray(this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action); if (\\"action\\" in values && values.action != null) { @@ -66378,9 +72400,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -66524,6 +72547,175 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Intent, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#action\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#action\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#resourceConformsTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#resourceConformsTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#availableQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#availableQuantity\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#minimumQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#minimumQuantity\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The type of economic transaction. The value of this property should be * either \`\\"deliverService\\"\` or \`\\"transfer\\"\`. @@ -66739,6 +72931,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) { + let element = ( { \\"@value\\": v } ); @@ -66759,6 +72952,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -66779,8 +72973,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66799,8 +72998,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66819,8 +73023,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66894,6 +73103,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/valueflows/ont/vf#action\\",\\"https://w3id.org/valueflows/ont/vf#availableQuantity\\",\\"https://w3id.org/valueflows/ont/vf#minimumQuantity\\",\\"https://w3id.org/valueflows/ont/vf#resourceConformsTo\\",\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -67103,7 +73314,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67135,7 +73351,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67167,7 +73388,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67184,6 +73410,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Intent.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -67488,6 +73724,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -67609,9 +73849,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -67717,6 +73958,128 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#purpose\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#purpose\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#publishes\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#publishes\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#reciprocal\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#reciprocal\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#unitBased\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#unitBased\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The type of proposal. Possible values are \`\\"offer\\"\` and \`\\"request\\"\`. * @@ -67916,6 +74279,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) { + let element = ( { \\"@value\\": v } ); @@ -67936,8 +74300,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -67956,8 +74325,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -67976,6 +74350,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) { + let element = ( { \\"@value\\": v } ); @@ -68062,6 +74437,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/valueflows/ont/vf#publishes\\",\\"https://w3id.org/valueflows/ont/vf#purpose\\",\\"https://w3id.org/valueflows/ont/vf#reciprocal\\",\\"https://w3id.org/valueflows/ont/vf#unitBased\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -68194,6 +74571,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Proposal)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -68246,7 +74626,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -68278,7 +74663,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -68324,6 +74714,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Proposal.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -68534,6 +74934,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -68605,9 +75009,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -68782,6 +75187,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -68918,6 +75325,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Accept)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -68925,6 +75335,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Accept.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -69056,6 +75476,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -69127,9 +75551,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -69304,6 +75729,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -69436,6 +75863,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Add)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -69443,6 +75873,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Add.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -69573,6 +76013,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -69644,9 +76088,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -69821,6 +76266,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -69953,6 +76400,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Announce)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -69960,6 +76410,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Announce.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -70823,6 +77283,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -71648,9 +78112,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -72092,6 +78557,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -72481,18 +79757,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -72642,18 +79922,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -73066,18 +80350,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -73231,18 +80519,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -73725,18 +81017,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -74169,18 +81465,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -74593,18 +81893,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -75020,18 +82324,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -75445,18 +82753,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -75868,18 +83180,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -76291,18 +83607,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -76711,18 +84031,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -77135,18 +84459,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -77701,18 +85029,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78184,18 +85516,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78349,18 +85685,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78773,18 +86113,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78938,18 +86282,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -79626,6 +86974,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -79649,8 +86998,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79669,8 +87023,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79689,6 +87048,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -79709,6 +87069,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -79729,8 +87090,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79749,8 +87119,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79769,8 +87148,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79789,8 +87173,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79809,8 +87198,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79829,8 +87223,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79849,8 +87248,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79869,8 +87273,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79889,8 +87298,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79909,8 +87323,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79929,6 +87348,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -79949,6 +87369,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -79969,6 +87390,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -79989,6 +87411,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -80009,6 +87432,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -80029,8 +87453,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80049,8 +87494,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80069,8 +87535,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80089,6 +87560,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -80109,6 +87581,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -80129,6 +87602,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -80230,6 +87704,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -80362,6 +87838,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Application)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -80426,7 +87905,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80467,7 +87951,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80568,11 +88057,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -80615,11 +88114,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -80660,7 +88169,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80701,7 +88215,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80742,7 +88261,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80783,7 +88307,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80824,7 +88353,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80865,7 +88399,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80906,7 +88445,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80938,7 +88482,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -81126,23 +88675,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -81184,23 +88758,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -81241,7 +88840,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -81346,6 +88950,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Application.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -82036,6 +89650,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -82107,9 +89725,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -82284,6 +89903,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -82428,6 +90049,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof IntransitiveActivity)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -82435,6 +90059,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + IntransitiveActivity.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -82565,6 +90199,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -82636,9 +90274,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -82813,6 +90452,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -82945,6 +90586,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Arrive)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -82952,6 +90596,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Arrive.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -83119,6 +90773,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -83232,9 +90890,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -83362,6 +91021,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -83731,18 +91487,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -84175,18 +91935,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -84362,8 +92126,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -84382,6 +92151,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -84406,8 +92176,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -84492,6 +92267,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -84624,6 +92401,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Article)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -84655,7 +92435,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -84735,7 +92520,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -84752,6 +92542,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Article.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -84975,6 +92775,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -85082,9 +92886,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -85138,6 +92943,99 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu }; return deepCloneGraph(this, this.clone(values, cloneOptions)); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#width\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#width\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#height\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#height\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Specifies a hint as to the rendering width in * device-independent pixels of the linked resource. @@ -85301,6 +93199,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -85324,6 +93223,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -85347,6 +93247,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + let element = ( { \\"@value\\": v } ); @@ -85433,6 +93334,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -85581,6 +93484,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Document)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -85676,6 +93582,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } instance.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = _2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Document.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -85857,6 +93773,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -85922,9 +93842,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -86112,6 +94033,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -86244,6 +94167,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Audio)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -86251,6 +94177,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Audio.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -86380,6 +94316,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -86451,9 +94391,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -86628,6 +94569,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -86764,6 +94707,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Ignore)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -86771,6 +94717,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Ignore.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -86902,6 +94858,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -86973,9 +94933,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -87150,6 +95111,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -87282,6 +95245,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Block)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -87289,6 +95255,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Block.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -87461,6 +95437,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -87577,9 +95557,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -87707,6 +95688,105 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#partOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#partOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#next\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#next\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#prev\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#prev\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchPartOf( url: URL, @@ -88075,18 +96155,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#partOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"partOf\\", + [\\"https://www.w3.org/ns/activitystreams#partOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -88494,18 +96578,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#next_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"next\\", + [\\"https://www.w3.org/ns/activitystreams#next\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -88914,18 +97002,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#prev_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"prev\\", + [\\"https://www.w3.org/ns/activitystreams#prev\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -89095,8 +97187,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89115,8 +97212,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89135,8 +97237,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89221,6 +97328,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#next\\",\\"https://www.w3.org/ns/activitystreams#partOf\\",\\"https://www.w3.org/ns/activitystreams#prev\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -89357,6 +97466,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof CollectionPage)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -89388,7 +97500,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89429,7 +97546,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89470,7 +97592,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89487,6 +97614,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + CollectionPage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -89674,6 +97811,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -89745,9 +97886,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -89922,6 +98064,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -90054,6 +98198,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Create)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -90061,6 +98208,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Create.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -90190,6 +98347,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -90261,9 +98422,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -90438,6 +98600,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -90570,6 +98734,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Delete)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -90577,6 +98744,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Delete.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -90704,6 +98881,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -90775,9 +98956,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -90952,6 +99134,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -91084,6 +99268,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Dislike)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -91091,6 +99278,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Dislike.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -91151,7 +99348,7 @@ instruments?: (Object | URL)[];} }; /** Contents of {@link Actor}'s \`endpoints\`. */ -export class Endpoints { +export class Endpoints implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -91167,6 +99364,14 @@ export class Endpoints { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -91382,6 +99587,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -91421,6 +99630,7 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length < vocabSparseArrayMinimumLength ? this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice() : vocabCopyPropertyArray(this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl); if (\\"proxyUrl\\" in values && values.proxyUrl != null) { @@ -91536,9 +99746,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -91748,6 +99959,217 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Endpoints, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#proxyUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#proxyUrl\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#oauthTokenEndpoint\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#oauthTokenEndpoint\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#provideClientKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#provideClientKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#signClientKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#signClientKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#sharedInbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#sharedInbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#uploadMedia\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#uploadMedia\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Endpoint URI so this actor's clients may access remote ActivityStreams * objects which require authentication to access. To use this endpoint, @@ -92038,6 +100460,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92058,6 +100481,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92078,6 +100502,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92098,6 +100523,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92118,6 +100544,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92138,6 +100565,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92158,6 +100586,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92233,6 +100662,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint\\",\\"https://www.w3.org/ns/activitystreams#oauthTokenEndpoint\\",\\"https://www.w3.org/ns/activitystreams#provideClientKey\\",\\"https://www.w3.org/ns/activitystreams#proxyUrl\\",\\"https://www.w3.org/ns/activitystreams#sharedInbox\\",\\"https://www.w3.org/ns/activitystreams#signClientKey\\",\\"https://www.w3.org/ns/activitystreams#uploadMedia\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -92571,6 +101002,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = _KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Endpoints.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -92847,6 +101288,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -92912,9 +101357,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -93102,6 +101548,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -93234,6 +101682,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Event)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -93241,6 +101692,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Event.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -93371,6 +101832,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -93442,9 +101907,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -93619,6 +102085,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -93751,6 +102219,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Flag)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -93758,6 +102229,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Flag.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -93889,6 +102370,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -93960,9 +102445,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -94137,6 +102623,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -94269,6 +102757,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Follow)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -94276,6 +102767,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Follow.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -95139,6 +103640,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -95964,9 +104469,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -96408,6 +104914,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -96797,18 +106114,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -96958,18 +106279,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -97382,18 +106707,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -97547,18 +106876,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -98041,18 +107374,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -98485,18 +107822,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -98909,18 +108250,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -99336,18 +108681,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -99761,18 +109110,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -100184,18 +109537,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -100607,18 +109964,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -101027,18 +110388,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -101451,18 +110816,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -102017,18 +111386,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -102500,18 +111873,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -102665,18 +112042,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -103089,18 +112470,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -103254,18 +112639,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -103942,6 +113331,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -103965,8 +113355,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -103985,8 +113380,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104005,6 +113405,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -104025,6 +113426,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -104045,8 +113447,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104065,8 +113476,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104085,8 +113505,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104105,8 +113530,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104125,8 +113555,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104145,8 +113580,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104165,8 +113605,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104185,8 +113630,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104205,8 +113655,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104225,8 +113680,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104245,6 +113705,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -104265,6 +113726,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -104285,6 +113747,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -104305,6 +113768,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -104325,6 +113789,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -104345,8 +113810,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104365,8 +113851,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104385,8 +113892,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104405,6 +113917,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -104425,6 +113938,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -104445,6 +113959,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -104546,6 +114061,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -104678,6 +114195,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Group)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -104742,7 +114262,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -104783,7 +114308,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -104884,11 +114414,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -104931,11 +114471,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -104976,7 +114526,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105017,7 +114572,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105058,7 +114618,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105099,7 +114664,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105140,7 +114710,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105181,7 +114756,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105222,7 +114802,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105254,7 +114839,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105442,23 +115032,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -105500,23 +115115,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -105557,7 +115197,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105662,6 +115307,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Group.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -106290,7 +115945,7 @@ get attributionDomains(): (string)[] { * the resource. * */ -export class Link { +export class Link implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -106306,6 +115961,14 @@ export class Link { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -106715,6 +116378,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -106756,6 +116423,7 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length < vocabSparseArrayMinimumLength ? this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice() : vocabCopyPropertyArray(this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href); if (\\"href\\" in values && values.href != null) { @@ -107064,9 +116732,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -107190,6 +116859,317 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Link, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#href\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#href\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#rel\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#rel\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#mediaType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#mediaType\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#name\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#name\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#hreflang\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang) { + + let element = ( +{ \\"@value\\": v.baseName } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#hreflang\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#height\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#height\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#width\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#width\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preview\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preview\\", descriptor); + + descriptor = { + canonicalIri: \\"http://purl.org/dc/terms/license\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://purl.org/dc/terms/license\\", descriptor); +descriptors.set(\\"https://schema.org/license\\", descriptor); +descriptors.set(\\"http://creativecommons.org/ns#license\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The target resource pointed to by a {@link Link}. */ @@ -107720,18 +117700,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#preview_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"preview\\", + [\\"https://www.w3.org/ns/activitystreams#preview\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -108015,6 +117999,7 @@ get licenses(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -108035,6 +118020,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel) { + let element = ( { \\"@value\\": v } ); @@ -108055,6 +118041,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { \\"@value\\": v } ); @@ -108075,6 +118062,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + let element = ( { \\"@value\\": v } ); @@ -108095,6 +118083,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -108118,6 +118107,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang) { + let element = ( { \\"@value\\": v.baseName } ); @@ -108138,6 +118128,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -108161,6 +118152,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -108184,8 +118176,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -108204,6 +118205,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -108289,6 +118291,8 @@ get licenses(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://purl.org/dc/terms/license\\",\\"https://schema.org/license\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#href\\",\\"https://www.w3.org/ns/activitystreams#hreflang\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#rel\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -108697,12 +118701,22 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -108756,6 +118770,16 @@ get licenses(): (URL)[] { } instance.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = _2rzkBRS4gNPrkJk9DohHAMUAxA2d; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Link.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -109097,6 +119121,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -109148,9 +119176,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -109313,6 +119342,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://purl.org/dc/terms/license\\",\\"https://schema.org/license\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#href\\",\\"https://www.w3.org/ns/activitystreams#hreflang\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#rel\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -109445,6 +119476,9 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Hashtag)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -109452,6 +119486,16 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Hashtag.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -109573,6 +119617,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -109638,9 +119686,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -109828,6 +119877,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -109960,6 +120011,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Image)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -109967,6 +120021,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Image.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -110097,6 +120161,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -110168,9 +120236,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -110345,6 +120414,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -110481,6 +120552,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Offer)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -110488,6 +120562,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Offer.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -110617,6 +120701,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -110688,9 +120776,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -110865,6 +120954,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -110997,6 +121088,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Invite)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -111004,6 +121098,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Invite.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -111133,6 +121237,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -111204,9 +121312,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -111381,6 +121490,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -111513,6 +121624,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Join)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -111520,6 +121634,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Join.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -111649,6 +121773,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -111720,9 +121848,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -111897,6 +122026,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -112029,6 +122160,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Leave)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -112036,6 +122170,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Leave.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -112165,6 +122309,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -112236,9 +122384,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -112413,6 +122562,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -112545,6 +122696,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Like)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -112552,6 +122706,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Like.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -112679,6 +122843,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -112750,9 +122918,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -112927,6 +123096,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -113059,6 +123230,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Listen)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -113066,6 +123240,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Listen.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -113173,6 +123357,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -113224,9 +123412,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -113389,6 +123578,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://purl.org/dc/terms/license\\",\\"https://schema.org/license\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#href\\",\\"https://www.w3.org/ns/activitystreams#hreflang\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#rel\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -113521,6 +123712,9 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Mention)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -113528,6 +123722,16 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Mention.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -113658,6 +123862,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -113729,9 +123937,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -113906,6 +124115,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -114038,6 +124249,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Move)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -114045,6 +124259,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Move.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -114214,6 +124438,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -114327,9 +124555,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -114457,6 +124686,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -114826,18 +125152,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -115270,18 +125600,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -115457,8 +125791,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -115477,6 +125816,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -115501,8 +125841,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -115587,6 +125932,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -115719,6 +126066,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Note)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -115750,7 +126100,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -115830,7 +126185,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -115847,6 +126207,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Note.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -116089,6 +126459,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -116213,9 +126587,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -116299,6 +126674,77 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#items\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollectionPage).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#items\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#startIndex\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollectionPage).#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#startIndex\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchItem( url: URL, @@ -116686,18 +127132,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"orderedItems\\", + [\\"https://www.w3.org/ns/activitystreams#items\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -116860,8 +127310,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -116880,6 +127339,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -116969,6 +127429,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#next\\",\\"https://www.w3.org/ns/activitystreams#partOf\\",\\"https://www.w3.org/ns/activitystreams#prev\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startIndex\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -117101,6 +127563,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof OrderedCollectionPage)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -117134,12 +127599,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -117185,6 +127660,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = _2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + OrderedCollectionPage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -118090,6 +128575,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -118915,9 +129404,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -119359,6 +129849,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -119748,18 +131049,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -119909,18 +131214,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -120333,18 +131642,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -120498,18 +131811,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -120992,18 +132309,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -121436,18 +132757,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -121860,18 +133185,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -122287,18 +133616,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -122712,18 +134045,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -123135,18 +134472,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -123558,18 +134899,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -123978,18 +135323,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -124402,18 +135751,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -124968,18 +136321,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -125451,18 +136808,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -125616,18 +136977,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -126040,18 +137405,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -126205,18 +137574,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -126893,6 +138266,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -126916,8 +138290,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -126936,8 +138315,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -126956,6 +138340,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -126976,6 +138361,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -126996,8 +138382,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127016,8 +138411,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127036,8 +138440,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127056,8 +138465,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127076,8 +138490,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127096,8 +138515,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127116,8 +138540,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127136,8 +138565,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127156,8 +138590,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127176,8 +138615,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127196,6 +138640,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -127216,6 +138661,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -127236,6 +138682,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -127256,6 +138703,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -127276,6 +138724,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -127296,8 +138745,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127316,8 +138786,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127336,8 +138827,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127356,6 +138852,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -127376,6 +138873,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -127396,6 +138894,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -127497,6 +138996,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -127629,6 +139130,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Organization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -127693,7 +139197,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127734,7 +139243,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127835,11 +139349,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -127882,11 +139406,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -127927,7 +139461,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127968,7 +139507,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128009,7 +139553,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128050,7 +139599,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128091,7 +139645,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128132,7 +139691,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128173,7 +139737,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128205,7 +139774,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128393,23 +139967,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -128451,23 +140050,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -128508,7 +140132,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128613,6 +140242,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Organization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -129294,6 +140933,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -129359,9 +141002,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -129549,6 +141193,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -129681,6 +141327,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Page)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -129688,6 +141337,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Page.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -130551,6 +142210,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -131376,9 +143039,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -131820,6 +143484,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -132209,18 +144684,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -132370,18 +144849,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -132794,18 +145277,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -132959,18 +145446,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -133453,18 +145944,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -133897,18 +146392,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -134321,18 +146820,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -134748,18 +147251,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -135173,18 +147680,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -135596,18 +148107,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -136019,18 +148534,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -136439,18 +148958,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -136863,18 +149386,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -137429,18 +149956,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -137912,18 +150443,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -138077,18 +150612,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -138501,18 +151040,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -138666,18 +151209,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -139354,6 +151901,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -139377,8 +151925,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139397,8 +151950,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139417,6 +151975,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -139437,6 +151996,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -139457,8 +152017,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139477,8 +152046,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139497,8 +152075,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139517,8 +152100,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139537,8 +152125,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139557,8 +152150,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139577,8 +152175,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139597,8 +152200,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139617,8 +152225,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139637,8 +152250,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139657,6 +152275,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -139677,6 +152296,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -139697,6 +152317,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -139717,6 +152338,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -139737,6 +152359,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -139757,8 +152380,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139777,8 +152421,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139797,8 +152462,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139817,6 +152487,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -139837,6 +152508,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -139857,6 +152529,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -139958,6 +152631,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -140090,6 +152765,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Person)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -140154,7 +152832,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140195,7 +152878,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140296,11 +152984,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140343,11 +153041,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140388,7 +153096,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140429,7 +153142,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140470,7 +153188,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140511,7 +153234,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140552,7 +153280,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140593,7 +153326,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140634,7 +153372,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140666,7 +153409,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140854,23 +153602,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140912,23 +153685,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140969,7 +153767,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -141074,6 +153877,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Person.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -141842,6 +154655,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -141991,9 +154808,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -142077,6 +154895,189 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#accuracy\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#accuracy\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#altitude\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#altitude\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#latitude\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#latitude\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#longitude\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#longitude\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#radius\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#radius\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#units\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units) { + + let element = ( +v == \\"cm\\" || v == \\"feet\\" || v == \\"inches\\" || v == \\"km\\" || v == \\"m\\" || v == \\"miles\\" ?{ \\"@value\\": v } :{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#units\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Indicates the accuracy of position coordinates on a {@link Place} objects. * Expressed in properties of percentage. e.g. \\"94.0\\" means \\"94.0% accurate\\". @@ -142331,6 +155332,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142354,6 +155356,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142377,6 +155380,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142400,6 +155404,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142423,6 +155428,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142446,6 +155452,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units) { + let element = ( v == \\"cm\\" || v == \\"feet\\" || v == \\"inches\\" || v == \\"km\\" || v == \\"m\\" || v == \\"miles\\" ? { \\"@value\\": v } : { \\"@id\\": formatIri(v) } ); @@ -142532,6 +155539,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#accuracy\\",\\"https://www.w3.org/ns/activitystreams#altitude\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#latitude\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#longitude\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#radius\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#units\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -142664,6 +155673,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Place)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -142848,6 +155860,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = _oKrwxU4V8wiKhMW1QEYQibcJh8c_units; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Place.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -143110,6 +156132,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -143192,9 +156218,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -143278,6 +156305,43 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#describes\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Profile).#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#describes\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchDescribes( url: URL, @@ -143646,18 +156710,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#describes_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"describes\\", + [\\"https://www.w3.org/ns/activitystreams#describes\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -143787,8 +156855,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -143873,6 +156946,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#describes\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -144005,6 +157080,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Profile)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -144036,7 +157114,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -144053,6 +157136,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Profile.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -144370,6 +157463,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -144607,9 +157704,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -144787,6 +157885,225 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#oneOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#oneOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#anyOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#anyOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#closed\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) { + + let element = ( +isTemporalInstant(v) ?{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } :{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#closed\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#votersCount\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#votersCount\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchExclusiveOption( url: URL, @@ -145160,18 +158477,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#exclusiveOption_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"oneOf\\", + [\\"https://www.w3.org/ns/activitystreams#oneOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -145587,18 +158908,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#inclusiveOption_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"anyOf\\", + [\\"https://www.w3.org/ns/activitystreams#anyOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -146040,18 +159365,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -146484,18 +159813,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -146586,8 +159919,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146606,8 +159944,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146626,6 +159969,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) { + let element = ( isTemporalInstant(v) ? { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -146649,6 +159993,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -146672,8 +160017,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146692,6 +160042,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -146716,8 +160067,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146802,6 +160158,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://joinmastodon.org/ns#votersCount\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#anyOf\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#closed\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#oneOf\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -146934,6 +160292,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Question)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -146965,7 +160326,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147006,7 +160372,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147115,7 +160486,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147195,7 +160571,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147212,6 +160593,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Question.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -147484,6 +160875,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -147555,9 +160950,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -147732,6 +161128,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -147864,6 +161262,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Read)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -147871,6 +161272,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Read.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -148000,6 +161411,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -148071,9 +161486,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -148248,6 +161664,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -148384,6 +161802,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Reject)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -148391,6 +161812,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Reject.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -148667,6 +162098,10 @@ relationships?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -148885,9 +162320,10 @@ relationships?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -149017,6 +162453,105 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#subject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#subject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#object\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#object\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#relationship\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#relationship\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchSubject( url: URL, @@ -149387,18 +162922,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#subject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"subject\\", + [\\"https://www.w3.org/ns/activitystreams#subject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -149807,18 +163346,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#object_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -149969,18 +163512,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#object_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -150392,18 +163939,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#relationship_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"relationship\\", + [\\"https://www.w3.org/ns/activitystreams#relationship\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -150556,18 +164107,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#relationship_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"relationship\\", + [\\"https://www.w3.org/ns/activitystreams#relationship\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -150738,8 +164293,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150758,8 +164318,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150778,8 +164343,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150864,6 +164434,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#relationship\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#subject\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -150996,6 +164568,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Relationship)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -151027,7 +164602,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151068,7 +164648,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151109,7 +164694,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151126,6 +164716,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Relationship.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -151327,6 +164927,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -151398,9 +165002,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -151575,6 +165180,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -151707,6 +165314,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Remove)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -151714,6 +165324,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Remove.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -152577,6 +166197,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -153402,9 +167026,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -153846,6 +167471,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -154235,18 +168671,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -154396,18 +168836,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -154820,18 +169264,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -154985,18 +169433,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -155479,18 +169931,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -155923,18 +170379,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -156347,18 +170807,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -156774,18 +171238,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -157199,18 +171667,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -157622,18 +172094,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -158045,18 +172521,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -158465,18 +172945,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -158889,18 +173373,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -159455,18 +173943,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -159938,18 +174430,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -160103,18 +174599,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -160527,18 +175027,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -160692,18 +175196,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -161380,6 +175888,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -161403,8 +175912,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161423,8 +175937,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161443,6 +175962,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -161463,6 +175983,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -161483,8 +176004,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161503,8 +176033,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161523,8 +176062,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161543,8 +176087,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161563,8 +176112,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161583,8 +176137,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161603,8 +176162,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161623,8 +176187,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161643,8 +176212,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161663,8 +176237,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161683,6 +176262,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -161703,6 +176283,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -161723,6 +176304,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -161743,6 +176325,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -161763,6 +176346,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -161783,8 +176367,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161803,8 +176408,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161823,8 +176449,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161843,6 +176474,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -161863,6 +176495,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -161883,6 +176516,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -161984,6 +176618,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -162116,6 +176752,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Service)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -162180,7 +176819,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162221,7 +176865,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162322,11 +176971,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162369,11 +177028,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162414,7 +177083,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162455,7 +177129,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162496,7 +177175,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162537,7 +177221,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162578,7 +177267,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162619,7 +177313,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162660,7 +177359,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162692,7 +177396,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162880,23 +177589,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162938,23 +177672,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162995,7 +177754,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -163100,6 +177864,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Service.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -163720,7 +178494,7 @@ get attributionDomains(): (string)[] { }; /** Contents of {@link Object}'s \`source\`. */ -export class Source { +export class Source implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -163736,6 +178510,14 @@ export class Source { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -163929,6 +178711,10 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -163969,6 +178755,7 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if (\\"content\\" in values && values.content != null) { @@ -164061,9 +178848,10 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -164120,6 +178908,85 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Source, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#content\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Source).#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#content\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#mediaType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Source).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#mediaType\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The source content. */ @@ -164239,6 +179106,7 @@ get contents(): ((string | LanguageString))[] { const values: Record = {}; array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -164262,6 +179130,7 @@ get contents(): ((string | LanguageString))[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { \\"@value\\": v } ); @@ -164342,6 +179211,8 @@ get contents(): ((string | LanguageString))[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -164540,6 +179411,16 @@ get contents(): ((string | LanguageString))[] { } instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Source.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -164730,6 +179611,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -164801,9 +179686,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -164978,6 +179864,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -165110,6 +179998,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof TentativeAccept)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -165117,6 +180008,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + TentativeAccept.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -165246,6 +180147,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -165317,9 +180222,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -165494,6 +180400,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -165626,6 +180534,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof TentativeReject)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -165633,6 +180544,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + TentativeReject.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -165833,6 +180754,10 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -165974,9 +180899,10 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -166031,6 +180957,69 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} }; return deepCloneGraph(this, this.clone(values, cloneOptions)); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#formerType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Tombstone).#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType) { + + let element = ( +{ \\"@id\\": v.typeId.href } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#formerType\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#deleted\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Tombstone).#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#deleted\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** On a \`Tombstone\` object, the \`formerType\` property identifies the type of * the object that was deleted. @@ -166169,6 +181158,7 @@ get formerTypes(): (\$EntityType)[] { array = []; for (const v of this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType) { + let element = ( { \\"@id\\": v.typeId.href } ); @@ -166189,6 +181179,7 @@ get formerTypes(): (\$EntityType)[] { array = []; for (const v of this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -166283,6 +181274,8 @@ get formerTypes(): (\$EntityType)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#deleted\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#formerType\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -166415,6 +181408,9 @@ get formerTypes(): (\$EntityType)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Tombstone)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -166497,6 +181493,16 @@ get formerTypes(): (\$EntityType)[] { } instance.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Tombstone.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -166674,6 +181680,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -166745,9 +181755,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -166922,6 +181933,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -167054,6 +182067,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Travel)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -167061,6 +182077,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Travel.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -167195,6 +182221,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -167266,9 +182296,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -167443,6 +182474,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -167575,6 +182608,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Undo)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -167582,6 +182618,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Undo.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -167714,6 +182760,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -167785,9 +182835,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -167962,6 +183013,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -168094,6 +183147,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Update)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -168101,6 +183157,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Update.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -168222,6 +183288,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -168287,9 +183357,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -168477,6 +183548,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -168609,6 +183682,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Video)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -168616,6 +183692,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Video.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -168744,6 +183830,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -168815,9 +183905,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -168992,6 +184083,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -169124,6 +184217,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof View)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -169131,6 +184227,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + View.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && 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 8e7e1afc8..af84e7661 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap @@ -25,7 +25,9 @@ import { parseIri, parseJsonLdId, type PortableObjectVerifier, - type RemoteDocument + type RawPropertyValue, + type RemoteDocument, + type VocabularyObject } from \\"@fedify/vocab-runtime\\"; import { compactJsonLdCache, @@ -54,6 +56,16 @@ import { rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject } from \\"@fedify/vocab-runtime/internal/portable-dereference\\"; +import { + createRawPropertyEncodingOptions, + encodeNestedVocabularyValue, + expandRawPropertyValue, + RAW_PROPERTY_PROTOCOL, + type RawPropertyRequest, + readRawPropertyValues, + retainRawProperties, + type RetainedRawProperties +} from \\"@fedify/vocab-runtime/internal/raw-property\\"; import { enterSignedValueScope, resolveSignedValues, @@ -367,6 +379,289 @@ function deepCloneGraph(source: object, root: T): T { return root; } +type RawPropertyEncoder = ( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, +) => Promise; + +interface RawPropertyDescriptor { + readonly canonicalIri: string; + readonly encode: RawPropertyEncoder; +} + +// Unknown properties retained while decoding, keyed by the decoded object: +const retainedRawProperties = new WeakMap(); + +// Encoders of the properties each generated class declares, keyed by the +// class's prototype and then by the property IRIs, including aliases: +const rawPropertyDescriptors = new Map< + object, + ReadonlyMap +>(); + +function getRawPropertyDescriptor( + object: object, + iri: string, +): RawPropertyDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(object); + while (prototype != null) { + const descriptor = rawPropertyDescriptors.get(prototype)?.get(iri); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function copyRawProperties(source: object, destination: object): void { + const retained = retainedRawProperties.get(source); + if (retained == null) retainedRawProperties.delete(destination); + else retainedRawProperties.set(destination, retained); +} + +// The contexts in effect for the cached JSON-LD of embedded objects, which +// stays as it was received, keyed by the objects. Telling which keys of such +// a document are which properties takes the contexts of its parents as well: +const cachedJsonLdContexts = new WeakMap(); + +function getCachedJsonLdContext(object: object, context: unknown): unknown { + return cachedJsonLdContexts.has(object) + ? cachedJsonLdContexts.get(object) + : context; +} + +// Objects that were given the document they were received as: +const receivedJsonLd = new WeakSet(); + +// Gives an embedded object, decoded along with the whole document, the document +// it was received as, which toJsonLd() has to return as is, as a proof can +// cover it. The object is not decoded from that document, since an embedded +// document alone cannot rebuild what its parents' contexts contributed to it, +// such as type-scoped and property-scoped contexts: +function keepReceivedJsonLd( + object: unknown, + document: object, + parentContext: unknown, +): void { + if ( + object == null || typeof object !== \\"object\\" || + !(RAW_PROPERTY_PROTOCOL in object) || receivedJsonLd.has(object) + ) { + return; + } + receivedJsonLd.add(object); + (object as unknown as { _cachedJsonLd?: unknown })._cachedJsonLd = + structuredClone(document); + const own = (document as { \\"@context\\"?: unknown })[\\"@context\\"]; + cachedJsonLdContexts.set(object, [ + ...(globalThis.Array.isArray(parentContext) + ? parentContext + : [parentContext]), + ...(globalThis.Array.isArray(own) ? own : [own]), + ]); +} + +// The results of isCachedPropertyKey(), keyed by the document and then by the +// key: +const cachedPropertyKeys = new WeakMap>>(); + +async function expandTopLevelKeys( + document: Record, + contextLoader: DocumentLoader, +): Promise { + const expanded = await jsonld.expand(document, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + return globalThis.Object.keys(expanded[0] ?? {}).filter((iri) => + !iri.startsWith(\\"@\\") + ); +} + +// The number of expansions must not depend on the document, which can come +// from a remote peer, as each of them can load the contexts again: +async function mapsOnlyKeyToProperty( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + const own = await expandTopLevelKeys( + { \\"@context\\": context, [key]: [] }, + contextLoader, + ); + if (own.length !== 1 || own[0] !== iris[0]) return false; + // Only the keys matter, so nested values and their contexts are left out, + // while scalars stay for keyword aliases such as id, which require them: + const others: Record = { \\"@context\\": context }; + for (const [k, value] of globalThis.Object.entries(document)) { + if (k === key || k.startsWith(\\"@\\")) continue; + others[k] = value != null && typeof value === \\"object\\" ? [] : value; + } + try { + const expanded = await expandTopLevelKeys(others, contextLoader); + return !expanded.some((iri) => iris.includes(iri)); + } catch { + // Some other term could not take the placeholder, so nothing is known: + return false; + } +} + +// Whether the embedded documents under a key of a compacted document are the +// values decoded for a property. The document has to map the key, and no other +// key, to the property, as a context can remap the key or map another term to +// the property, in which case the cached documents cannot be matched with the +// decoded values: +async function isCachedPropertyKey( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + let checks = cachedPropertyKeys.get(document); + if (checks == null) { + checks = new Map(); + cachedPropertyKeys.set(document, checks); + } + const cached = checks.get(key); + if (cached != null) return await cached; + const check = mapsOnlyKeyToProperty( + document, + context, + key, + iris, + contextLoader, + ); + // A failure, such as of the context loader, is not remembered, as another + // call can pass another loader: + const map = checks; + check.catch(() => map.delete(key)); + checks.set(key, check); + return await check; +} + +async function readRawProperty( + object: object, + request: RawPropertyRequest, + contextLoader: DocumentLoader, +): Promise { + const retained = retainedRawProperties.get(object); + for (const iri of request.candidates) { + const descriptor = getRawPropertyDescriptor(object, iri); + if (descriptor != null) { + const value = await descriptor.encode( + object, + createRawPropertyEncodingOptions(request.stack, contextLoader), + ); + return value === undefined ? [] : await expandRawPropertyValue( + descriptor.canonicalIri, + value, + contextLoader, + ); + } + if (retained != null && globalThis.Object.hasOwn(retained, iri)) { + return retained[iri]; + } + } + return []; +} + +/** + * Gets the values of a property of a vocabulary object in expanded JSON-LD, + * looking the property up by its full IRI. This works for properties that + * have no typed accessor as well as for those that do. + * + * *Raw* means untyped expanded JSON-LD values, such as + * \`{ \\"@value\\": \\"Hello\\" }\` or \`{ \\"@id\\": \\"https://example.com/\\" }\`, as + * opposed to the values that typed accessors return. It does not mean the + * received document: + * + * - For a property that the object's class has no accessor for, the result + * is the values retained when the object was decoded by \`fromJsonLd()\`. + * Objects constructed locally have none. + * - For a property that the class has an accessor for, including a + * redundant alias of such a property, the result is the current typed + * values encoded back into expanded JSON-LD. It reflects \`clone()\` + * replacements and objects fetched by dereferencing accessors, and it can + * differ from the received values: for example, values that failed to + * decode are missing, and lexical forms such as date-times are + * normalized. When a later release adds an accessor for a property, + * the result for that property switches from the retained values to the + * encoded ones. + * + * The values are not verified in any way, and IRIs in them are never + * dereferenced. Validate them before use, as with any other data received + * from a remote server. The result is a deep copy, so modifying it does not + * affect the object. + * + * The IRI is matched as given, and then as normalized by the WHATWG URL + * parser. Prefixes are never expanded: \`\\"as:content\\"\` is a valid IRI with + * the \`as:\` scheme, so it normally matches nothing. An IRI whose scheme is + * not \`http:\` or \`https:\` is therefore logged as a warning under the + * \`[\\"fedify\\", \\"vocab\\"]\` category. + * + * \`\`\`typescript ignore + * const values = await getRawPropertyValues( + * note, + * \\"https://w3id.org/quantpub#structuredUrl\\", + * ); + * for (const value of values) { + * if (\\"@id\\" in value && typeof value[\\"@id\\"] === \\"string\\") { + * console.log(new URL(value[\\"@id\\"])); + * } + * } + * \`\`\` + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The values of the property, or an empty array if it has none. + * @throws {TypeError} If \`propertyIri\` is not an absolute IRI, e.g., an + * empty string, a JSON-LD keyword such as \`\\"@id\\"\`, a + * blank node identifier, a term, or a relative + * reference; if \`object\` is not a generated vocabulary + * object; or if encoding the values of a known property + * meets a cycle of objects. + * @since 2.5.0 + */ +export function getRawPropertyValues( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + return readRawPropertyValues(object, propertyIri, \\"getRawPropertyValues\\"); +} + +/** + * Gets the first value of a property of a vocabulary object in expanded + * JSON-LD, looking the property up by its full IRI. It is equivalent to + * \`(await getRawPropertyValues(object, propertyIri))[0] ?? null\`; see + * {@link getRawPropertyValues} for how the values are obtained. + * + * It does not throw when the property has multiple values. JSON-LD does not + * order the values of a property unless it is a list, so the first value is + * not more significant than the others. A list property has a single value, + * the \`{ \\"@list\\": [...] }\` object. + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The first value of the property, or \`null\` if it has none. + * @throws {TypeError} In the same cases as {@link getRawPropertyValues}. + * @since 2.5.0 + */ +export async function getRawPropertyValue( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + const values = await readRawPropertyValues( + object, + propertyIri, + \\"getRawPropertyValue\\", + ); + return values[0] ?? null; +} + function isValidLanguageTag(language: string): boolean { try { new Intl.Locale(normalizeLanguageTag(language)); @@ -449,7 +744,7 @@ import * as _ppM0 from \\"./preprocessors.ts\\"; * {@link OrderedCollection}. * */ -export class Object { +export class Object implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -465,6 +760,14 @@ export class Object { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -2130,6 +2433,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -2185,6 +2492,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length < vocabSparseArrayMinimumLength ? this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice() : vocabCopyPropertyArray(this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment);clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = vocabCopyTrustSet( this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, @@ -3769,9 +4077,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -4481,6 +4790,1263 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Object, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#attachment\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#attachment\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#attributedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#attributedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#audience\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#audience\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#content\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#content\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#context\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#context\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#name\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#name\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endTime\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endTime\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#generator\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#generator\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#icon\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#icon\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#image\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#image\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#inReplyTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#inReplyTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#location\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#location\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preview\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preview\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#published\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#published\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#replies\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_7UpwM3JWcXhADcscukEehBorf6k_replies) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#replies\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#shares\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#shares\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#likes\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#likes\\", descriptor); + + descriptor = { + canonicalIri: \\"http://fedibird.com/ns#emojiReactions\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://fedibird.com/ns#emojiReactions\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#startTime\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#startTime\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#summary\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#summary\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#tag\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#tag\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#updated\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#updated\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#url\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + + let element = ( +v instanceof URL ?{ \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#url\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#to\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#to\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#bto\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#bto\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#cc\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#cc\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#bcc\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#bcc\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#mediaType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#mediaType\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#duration\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#duration\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#duration\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#sensitive\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#sensitive\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#source\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#source\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#proof\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push({ \\"@graph\\": element }); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#proof\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionPolicy\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionPolicy\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#approvedBy\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#approvedBy\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#likeAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#likeAuthorization\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#replyAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#replyAuthorization\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#announceAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#announceAuthorization\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/22cd#translations\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/22cd#translations\\", descriptor); + + descriptor = { + canonicalIri: \\"http://purl.org/dc/terms/license\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://purl.org/dc/terms/license\\", descriptor); +descriptors.set(\\"https://schema.org/license\\", descriptor); +descriptors.set(\\"http://creativecommons.org/ns#license\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchAttachment( url: URL, @@ -4884,18 +6450,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#attachment_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"attachment\\", + [\\"https://www.w3.org/ns/activitystreams#attachment\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -5367,18 +6937,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#attribution_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"attributedTo\\", + [\\"https://www.w3.org/ns/activitystreams#attributedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -5531,18 +7105,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#attribution_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"attributedTo\\", + [\\"https://www.w3.org/ns/activitystreams#attributedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -5953,18 +7531,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#audience_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"audience\\", + [\\"https://www.w3.org/ns/activitystreams#audience\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -6116,18 +7698,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#audience_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"audience\\", + [\\"https://www.w3.org/ns/activitystreams#audience\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -6591,18 +8177,22 @@ get contents(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#context_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"context\\", + [\\"https://www.w3.org/ns/activitystreams#context\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -7073,18 +8663,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#generator_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"generator\\", + [\\"https://www.w3.org/ns/activitystreams#generator\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -7518,18 +9112,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#icon_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"icon\\", + [\\"https://www.w3.org/ns/activitystreams#icon\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -7682,18 +9280,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#icon_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"icon\\", + [\\"https://www.w3.org/ns/activitystreams#icon\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8127,18 +9729,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#image_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"image\\", + [\\"https://www.w3.org/ns/activitystreams#image\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8291,18 +9897,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#image_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"image\\", + [\\"https://www.w3.org/ns/activitystreams#image\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8728,18 +10338,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#replyTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inReplyTo\\", + [\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -8891,18 +10505,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#replyTarget_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inReplyTo\\", + [\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -9328,18 +10946,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#location_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"location\\", + [\\"https://www.w3.org/ns/activitystreams#location\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -9491,18 +11113,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#location_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"location\\", + [\\"https://www.w3.org/ns/activitystreams#location\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -9927,18 +11553,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#preview_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"preview\\", + [\\"https://www.w3.org/ns/activitystreams#preview\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -10089,18 +11719,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#preview_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"preview\\", + [\\"https://www.w3.org/ns/activitystreams#preview\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -10524,18 +12158,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#replies_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"replies\\", + [\\"https://www.w3.org/ns/activitystreams#replies\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -10951,18 +12589,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#shares_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"shares\\", + [\\"https://www.w3.org/ns/activitystreams#shares\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -11378,18 +13020,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likes_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likes\\", + [\\"https://www.w3.org/ns/activitystreams#likes\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -11799,18 +13445,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#emojiReactions_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"emojiReactions\\", + [\\"http://fedibird.com/ns#emojiReactions\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -12281,18 +13931,22 @@ get summaries(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#tag_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"tag\\", + [\\"https://www.w3.org/ns/activitystreams#tag\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -12737,18 +14391,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#to_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"to\\", + [\\"https://www.w3.org/ns/activitystreams#to\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -12900,18 +14558,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#to_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"to\\", + [\\"https://www.w3.org/ns/activitystreams#to\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -13322,18 +14984,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#bto_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bto\\", + [\\"https://www.w3.org/ns/activitystreams#bto\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -13485,18 +15151,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#bto_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bto\\", + [\\"https://www.w3.org/ns/activitystreams#bto\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -13907,18 +15577,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#cc_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"cc\\", + [\\"https://www.w3.org/ns/activitystreams#cc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -14070,18 +15744,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#cc_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"cc\\", + [\\"https://www.w3.org/ns/activitystreams#cc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -14492,18 +16170,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#bcc_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bcc\\", + [\\"https://www.w3.org/ns/activitystreams#bcc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -14655,18 +16337,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#bcc_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"bcc\\", + [\\"https://www.w3.org/ns/activitystreams#bcc\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -15140,18 +16826,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#proof_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"proof\\", + [\\"https://w3id.org/security#proof\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -15302,18 +16992,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#proof_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"proof\\", + [\\"https://w3id.org/security#proof\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -15763,18 +17457,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likeAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likeAuthorization\\", + [\\"https://gotosocial.org/ns#likeAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -16184,18 +17882,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#replyAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"replyAuthorization\\", + [\\"https://gotosocial.org/ns#replyAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -16605,18 +18307,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#announceAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"announceAuthorization\\", + [\\"https://gotosocial.org/ns#announceAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -17534,8 +19240,21 @@ get licenses(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17554,8 +19273,29 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17574,8 +19314,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17594,6 +19339,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -17617,8 +19363,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17637,6 +19392,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -17660,6 +19416,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17683,8 +19440,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17703,8 +19469,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17723,8 +19494,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17743,8 +19519,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17763,8 +19548,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17783,8 +19577,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17803,6 +19606,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17826,8 +19630,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_7UpwM3JWcXhADcscukEehBorf6k_replies) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17846,8 +19655,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17866,8 +19680,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17886,8 +19705,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17906,6 +19730,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17929,6 +19754,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -17952,8 +19778,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17972,6 +19807,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -17995,8 +19831,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + let element = ( - v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options) + v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18015,8 +19856,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18035,8 +19881,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18055,8 +19906,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18075,8 +19931,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18095,6 +19956,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { \\"@value\\": v } ); @@ -18115,6 +19977,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#duration\\", @@ -18138,6 +20001,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { + let element = ( { \\"@value\\": v } ); @@ -18158,8 +20022,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18178,8 +20047,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18198,8 +20072,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18218,6 +20097,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -18238,8 +20118,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18258,8 +20143,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18278,8 +20168,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18298,8 +20193,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18318,6 +20218,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -18439,6 +20340,8 @@ get licenses(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -18872,16 +20775,31 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : typeof v === \\"object\\" && \\"@type\\" in v && Array.isArray(v[\\"@type\\"])&& v[\\"@type\\"].includes(\\"http://schema.org#PropertyValue\\") ? await PropertyValue.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -18923,23 +20841,48 @@ get licenses(): (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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -18980,7 +20923,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19056,12 +21004,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19170,12 +21128,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19239,7 +21207,12 @@ get licenses(): (URL)[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19303,7 +21276,12 @@ get licenses(): (URL)[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19346,12 +21324,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19394,12 +21382,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19442,12 +21440,22 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19521,7 +21529,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19562,7 +21575,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19603,7 +21621,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19644,7 +21667,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19753,12 +21781,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19827,7 +21865,12 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19868,7 +21911,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19909,7 +21957,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19950,7 +22003,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19991,7 +22049,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20111,7 +22174,12 @@ get licenses(): (URL)[] { const decoded = await Source.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20157,7 +22225,12 @@ get licenses(): (URL)[] { const decoded = await DataIntegrityProof.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20189,7 +22262,12 @@ get licenses(): (URL)[] { const decoded = await InteractionPolicy.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20259,7 +22337,12 @@ get licenses(): (URL)[] { const decoded = await LikeAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20300,7 +22383,12 @@ get licenses(): (URL)[] { const decoded = await ReplyAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20341,7 +22429,12 @@ get licenses(): (URL)[] { const decoded = await AnnounceAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20373,7 +22466,12 @@ get licenses(): (URL)[] { const decoded = await Translation.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20427,6 +22525,16 @@ get licenses(): (URL)[] { } instance.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = _2rzkBRS4gNPrkJk9DohHAMUAxA2d; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Object.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -21451,6 +23559,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -21516,9 +23628,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -21706,6 +23819,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -21838,6 +23953,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Emoji)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -21845,6 +23963,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Emoji.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -22017,6 +24145,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -22130,9 +24262,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -22260,6 +24393,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -22629,18 +24859,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -23073,18 +25307,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -23260,8 +25498,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -23280,6 +25523,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -23304,8 +25548,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -23390,6 +25639,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -23522,6 +25773,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ChatMessage)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -23553,7 +25807,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -23633,7 +25892,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -23650,6 +25914,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ChatMessage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -24232,6 +26506,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -24705,9 +26983,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -24907,6 +27186,214 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#actor\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#actor\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#object\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#object\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#target\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#target\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#result\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#result\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#origin\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#origin\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#instrument\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#instrument\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchActor( url: URL, @@ -25336,18 +27823,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#actor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"actor\\", + [\\"https://www.w3.org/ns/activitystreams#actor\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -25500,18 +27991,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#actor_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"actor\\", + [\\"https://www.w3.org/ns/activitystreams#actor\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -25923,18 +28418,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#object_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -26087,18 +28586,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#object_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -26513,18 +29016,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#target_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"target\\", + [\\"https://www.w3.org/ns/activitystreams#target\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -26680,18 +29187,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#target_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"target\\", + [\\"https://www.w3.org/ns/activitystreams#target\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27103,18 +29614,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#result_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"result\\", + [\\"https://www.w3.org/ns/activitystreams#result\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27267,18 +29782,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#result_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"result\\", + [\\"https://www.w3.org/ns/activitystreams#result\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27691,18 +30210,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#origin_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"origin\\", + [\\"https://www.w3.org/ns/activitystreams#origin\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -27856,18 +30379,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#origin_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"origin\\", + [\\"https://www.w3.org/ns/activitystreams#origin\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -28278,18 +30805,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#instrument_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"instrument\\", + [\\"https://www.w3.org/ns/activitystreams#instrument\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -28441,18 +30972,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#instrument_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"instrument\\", + [\\"https://www.w3.org/ns/activitystreams#instrument\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -28544,8 +31079,29 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28564,8 +31120,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28584,8 +31145,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28604,8 +31170,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28624,8 +31195,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28644,8 +31220,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28730,6 +31311,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -29002,6 +31585,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Activity)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -29034,23 +31620,48 @@ const base = getDeepCloneDescriptor(this.prototype)!; 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -29091,7 +31702,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29132,7 +31748,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29173,7 +31794,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29214,7 +31840,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29255,7 +31886,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29272,6 +31908,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Activity.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -29556,6 +32202,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -29627,9 +32277,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -29804,6 +32455,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -29936,6 +32589,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof EmojiReact)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -29943,6 +32599,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + EmojiReact.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -30003,7 +32669,7 @@ instruments?: (Object | URL)[];} }; /** A pair of property name and value. */ -export class PropertyValue { +export class PropertyValue implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -30019,6 +32685,14 @@ export class PropertyValue { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -30164,6 +32838,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -30203,6 +32881,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { @@ -30248,9 +32927,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -30306,6 +32986,88 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: PropertyValue, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#name\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as PropertyValue).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#name\\", descriptor); + + descriptor = { + canonicalIri: \\"http://schema.org#value\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as PropertyValue).#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://schema.org#value\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The name of a property. */ @@ -30422,6 +33184,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -30445,6 +33208,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -30533,6 +33297,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://schema.org#value\\",\\"https://www.w3.org/ns/activitystreams#name\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -30734,6 +33500,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + PropertyValue.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -30849,7 +33625,7 @@ deepCloneDescriptors.set(this.prototype, { }; /** A quantity with a unit of measure. */ -export class Measure { +export class Measure implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -30865,6 +33641,14 @@ export class Measure { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -31010,6 +33794,10 @@ unit?: string | null;numericalValue?: Decimal | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -31049,6 +33837,7 @@ unit?: string | null;numericalValue?: Decimal | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < vocabSparseArrayMinimumLength ? this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice() : vocabCopyPropertyArray(this.#_27fgyFbosTtMAhuepJH8K3ZGURT6); if (\\"unit\\" in values && values.unit != null) { @@ -31094,9 +33883,10 @@ unit?: string | null;numericalValue?: Decimal | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -31152,6 +33942,85 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Measure, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Measure).#_27fgyFbosTtMAhuepJH8K3ZGURT6) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Measure).#_1GQx8o2RgxRs4x9G5uT39XYBv7D) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#decimal\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The name of the unit, according to the Ontology of units of Measure * classification. The recommended unit for countable items is \`\\"one\\"\`. @@ -31266,6 +34135,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) { + let element = ( { \\"@value\\": v } ); @@ -31286,6 +34156,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#decimal\\", @@ -31364,6 +34235,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue\\",\\"http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -31558,6 +34431,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = _1GQx8o2RgxRs4x9G5uT39XYBv7D; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Measure.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -31775,6 +34658,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -31874,9 +34761,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -31982,6 +34870,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as AnnounceAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as AnnounceAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -32350,18 +35306,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -32770,18 +35730,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -32931,8 +35895,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -32951,8 +35920,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -33037,6 +36011,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -33169,6 +36145,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof AnnounceAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -33200,7 +36179,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -33241,7 +36225,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -33258,6 +36247,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + AnnounceAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -33436,6 +36435,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -33507,9 +36510,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -33684,6 +36688,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -33816,6 +36822,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof AnnounceRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -33823,6 +36832,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + AnnounceRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -33890,7 +36909,7 @@ instruments?: (Object | URL)[];} * for details. * */ -export class InteractionPolicy { +export class InteractionPolicy implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -33906,6 +36925,14 @@ export class InteractionPolicy { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -34093,6 +37120,10 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -34132,6 +37163,7 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length < vocabSparseArrayMinimumLength ? this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice() : vocabCopyPropertyArray(this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature); if (\\"canFeature\\" in values && values.canFeature != null) { @@ -34219,9 +37251,10 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -34387,6 +37420,183 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: InteractionPolicy, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#canFeature\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#canFeature\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canLike\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canLike\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canReply\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canReply\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canAnnounce\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canAnnounce\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#canQuote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#canQuote\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The sub-policy specifying who can feature the actor in a * {@link FeaturedCollection}. @@ -34511,8 +37721,13 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34531,8 +37746,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34551,8 +37771,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34571,8 +37796,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34591,8 +37821,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34691,6 +37926,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://gotosocial.org/ns#canAnnounce\\",\\"https://gotosocial.org/ns#canLike\\",\\"https://gotosocial.org/ns#canQuote\\",\\"https://gotosocial.org/ns#canReply\\",\\"https://w3id.org/fep/7aa9#canFeature\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -34841,7 +38078,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34873,7 +38115,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34905,7 +38152,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34937,7 +38189,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34969,7 +38226,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34986,6 +38248,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = _LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + InteractionPolicy.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -35179,7 +38451,7 @@ deepCloneDescriptors.set(this.prototype, { * for details. * */ -export class InteractionRule { +export class InteractionRule implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -35195,6 +38467,14 @@ export class InteractionRule { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -35436,6 +38716,10 @@ manualApprovals?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -35477,6 +38761,7 @@ manualApprovals?: (URL)[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < vocabSparseArrayMinimumLength ? this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice() : vocabCopyPropertyArray(this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval); if (\\"automaticApproval\\" in values && values.automaticApproval != null) { @@ -35616,9 +38901,10 @@ manualApprovals?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -35720,6 +39006,82 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: InteractionRule, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#automaticApproval\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionRule).#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#automaticApproval\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#manualApproval\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionRule).#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#manualApproval\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** URIs of actors or collections whose interactions are automatically * approved without requiring manual review by the post author. @@ -35807,6 +39169,7 @@ get manualApprovals(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -35827,6 +39190,7 @@ get manualApprovals(): (URL)[] { array = []; for (const v of this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -35902,6 +39266,8 @@ get manualApprovals(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://gotosocial.org/ns#automaticApproval\\",\\"https://gotosocial.org/ns#manualApproval\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -36095,6 +39461,16 @@ get manualApprovals(): (URL)[] { } instance.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + InteractionRule.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -36323,6 +39699,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -36422,9 +39802,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -36530,6 +39911,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as LikeAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as LikeAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -36898,18 +40347,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -37318,18 +40771,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -37479,8 +40936,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -37499,8 +40961,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -37585,6 +41052,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -37717,6 +41186,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof LikeAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -37748,7 +41220,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -37789,7 +41266,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -37806,6 +41288,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + LikeAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -37983,6 +41475,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -38054,9 +41550,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -38231,6 +41728,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -38363,6 +41862,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof LikeRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -38370,6 +41872,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + LikeRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -38531,6 +42043,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -38630,9 +42146,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -38738,6 +42255,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ReplyAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ReplyAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -39106,18 +42691,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -39526,18 +43115,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -39687,8 +43280,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -39707,8 +43305,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -39793,6 +43396,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -39925,6 +43530,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ReplyAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -39956,7 +43564,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -39997,7 +43610,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -40014,6 +43632,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ReplyAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -40191,6 +43819,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -40262,9 +43894,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -40439,6 +44072,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -40571,6 +44206,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ReplyRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -40578,6 +44216,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ReplyRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -40739,6 +44387,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -40838,9 +44490,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -40946,6 +44599,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as QuoteAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as QuoteAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -41313,18 +45034,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -41733,18 +45458,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -41894,8 +45623,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -41914,8 +45648,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -42000,6 +45739,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -42132,6 +45873,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof QuoteAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -42163,7 +45907,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -42204,7 +45953,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -42221,6 +45975,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + QuoteAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -42398,6 +46162,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -42469,9 +46237,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -42646,6 +46415,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -42778,6 +46549,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof QuoteRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -42785,6 +46559,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + QuoteRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -42852,7 +46636,7 @@ instruments?: (Object | URL)[];} * Targets [draft revision 6d0d6559](https://codeberg.org/fediverse/fep/src/commit/6d0d6559054baeb7b71a5f2bdc14fc4c09b66f39/fep/22cd/fep-22cd.md). * */ -export class Translation { +export class Translation implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -42868,6 +46652,14 @@ export class Translation { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -43169,6 +46961,10 @@ urls?: ((URL | Link))[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -43210,6 +47006,7 @@ urls?: ((URL | Link))[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < vocabSparseArrayMinimumLength ? this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice() : vocabCopyPropertyArray(this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG); if (\\"language\\" in values && values.language != null) { @@ -43411,9 +47208,10 @@ urls?: ((URL | Link))[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -43559,6 +47357,217 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Translation, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://schema.org/inLanguage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) { + + let element = ( +{ \\"@value\\": v.baseName } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/inLanguage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://schema.org/translator\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/translator\\", descriptor); + + descriptor = { + canonicalIri: \\"https://schema.org/translationOfWork\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/translationOfWork\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/22cd#sourceUpdated\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/22cd#sourceUpdated\\", descriptor); + + descriptor = { + canonicalIri: \\"https://schema.org/isBasedOn\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://schema.org/isBasedOn\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#url\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + + let element = ( +v instanceof URL ?{ \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#url\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The translated language. Publishers must match a language in the * containing object's content, name, or summary map. @@ -44006,18 +48015,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#translator_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"translator\\", + [\\"https://schema.org/translator\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -44173,18 +48186,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#translator_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"translator\\", + [\\"https://schema.org/translator\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -44467,6 +48484,7 @@ get urls(): ((URL | Link))[] { const values: Record = {}; array = []; for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) { + let element = ( { \\"@value\\": v.baseName } ); @@ -44487,8 +48505,29 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -44507,6 +48546,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -44527,6 +48567,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -44550,6 +48591,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -44570,8 +48612,13 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + let element = ( - v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options) + v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -44650,6 +48697,8 @@ get urls(): ((URL | Link))[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://schema.org/inLanguage\\",\\"https://schema.org/isBasedOn\\",\\"https://schema.org/translationOfWork\\",\\"https://schema.org/translator\\",\\"https://w3id.org/fep/22cd#sourceUpdated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -44839,23 +48888,48 @@ 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -44982,7 +49056,12 @@ 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -44999,6 +49078,16 @@ get urls(): ((URL | Link))[] { } instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Translation.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -45303,6 +49392,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -45402,9 +49495,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -45510,6 +49604,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactingObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeatureAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactingObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://gotosocial.org/ns#interactionTarget\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeatureAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://gotosocial.org/ns#interactionTarget\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -45876,18 +50038,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactingObject\\", + [\\"https://gotosocial.org/ns#interactingObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -46295,18 +50461,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"interactionTarget\\", + [\\"https://gotosocial.org/ns#interactionTarget\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -46456,8 +50626,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -46476,8 +50651,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -46562,6 +50742,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactingObject\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#interactionTarget\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -46694,6 +50876,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeatureAuthorization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -46725,7 +50910,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -46766,7 +50956,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -46783,6 +50978,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeatureAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -46957,6 +51162,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -47028,9 +51237,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -47205,6 +51415,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -47337,6 +51549,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeatureRequest)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -47344,6 +51559,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeatureRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -47704,6 +51929,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -48015,9 +52244,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -48343,6 +52573,418 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#totalItems\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#totalItems\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#current\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3UyUdxnyn6cDn53QKrh4MBiearma_current) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#current\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#first\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_J52RqweMe6hhv7RnLJMC8BExTE5_first) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#first\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#last\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#last\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#items\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#items\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#likesOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#likesOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#sharesOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#sharesOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#repliesOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#repliesOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#inboxOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#inboxOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#outboxOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#outboxOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#followersOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#followersOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#followingOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#followingOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/5711#likedOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/5711#likedOf\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A non-negative integer specifying the total number of objects contained by * the logical view of the collection. This number might not reflect the actual @@ -48727,18 +53369,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#current_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"current\\", + [\\"https://www.w3.org/ns/activitystreams#current\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -49148,18 +53794,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#first_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"first\\", + [\\"https://www.w3.org/ns/activitystreams#first\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -49569,18 +54219,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#last_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"last\\", + [\\"https://www.w3.org/ns/activitystreams#last\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -50009,18 +54663,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"items\\", + [\\"https://www.w3.org/ns/activitystreams#items\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -50430,18 +55088,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likesOf\\", + [\\"https://w3id.org/fep/5711#likesOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -50850,18 +55512,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#sharesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"sharesOf\\", + [\\"https://w3id.org/fep/5711#sharesOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -51270,18 +55936,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#repliesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"repliesOf\\", + [\\"https://w3id.org/fep/5711#repliesOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -51690,18 +56360,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inboxOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inboxOf\\", + [\\"https://w3id.org/fep/5711#inboxOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -52110,18 +56784,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outboxOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outboxOf\\", + [\\"https://w3id.org/fep/5711#outboxOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -52530,18 +57208,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followersOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followersOf\\", + [\\"https://w3id.org/fep/5711#followersOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -52950,18 +57632,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followingOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followingOf\\", + [\\"https://w3id.org/fep/5711#followingOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -53370,18 +58056,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#likedOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"likedOf\\", + [\\"https://w3id.org/fep/5711#likedOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -53751,6 +58441,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -53774,8 +58465,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53794,8 +58490,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53814,8 +58515,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53834,8 +58540,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53854,8 +58569,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53874,8 +58594,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53894,8 +58619,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53914,8 +58644,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53934,8 +58669,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53954,8 +58694,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53974,8 +58719,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53994,8 +58744,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -54080,6 +58835,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -54228,6 +58985,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Collection)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -54288,7 +59048,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54329,7 +59094,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54370,7 +59140,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54413,12 +59188,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -54459,7 +59244,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54500,7 +59290,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54541,7 +59336,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54582,7 +59382,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54623,7 +59428,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54664,7 +59474,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54705,7 +59520,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54746,7 +59566,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54763,6 +59588,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Collection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -55192,6 +60027,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -55302,9 +60141,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -55388,6 +60228,47 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#items\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollection).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#items\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchItem( url: URL, @@ -55775,18 +60656,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"orderedItems\\", + [\\"https://www.w3.org/ns/activitystreams#items\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -55918,8 +60803,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -56004,6 +60898,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -56140,6 +61036,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof OrderedCollection)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -56173,12 +61072,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -56195,6 +61104,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + OrderedCollection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -56369,6 +61288,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -56462,9 +61385,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -56548,6 +61472,70 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#topic\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedCollection).#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#topic\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedCollection).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A single {@link Hashtag} object that represents the main topic or category * of this featured collection. @@ -56683,8 +61671,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -56703,6 +61696,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -56789,6 +61783,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/fep/7aa9#topic\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -56921,6 +61917,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeaturedCollection)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -56943,7 +61942,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Hashtag.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -56989,6 +61993,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeaturedCollection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -57185,6 +62199,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -57284,9 +62302,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -57392,6 +62411,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredObject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedItem).#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredObject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featureAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedItem).#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featureAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchFeaturedObject( url: URL, @@ -57758,18 +62845,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredObject\\", + [\\"https://w3id.org/fep/7aa9#featuredObject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -58179,18 +63270,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featureAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featureAuthorization\\", + [\\"https://w3id.org/fep/7aa9#featureAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -58340,8 +63435,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -58360,8 +63460,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -58446,6 +63551,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/7aa9#featureAuthorization\\",\\"https://w3id.org/fep/7aa9#featuredObject\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -58578,6 +63685,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeaturedItem)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -58609,7 +63719,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -58650,7 +63765,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await FeatureAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -58667,6 +63787,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeaturedItem.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -58771,7 +63901,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; * and verifiable credential repository services. * */ -export class DidService { +export class DidService implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -58787,6 +63917,14 @@ export class DidService { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -58966,6 +64104,10 @@ endpoints?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -59006,6 +64148,7 @@ endpoints?: (URL)[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < vocabSparseArrayMinimumLength ? this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice() : vocabCopyPropertyArray(this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint); if (\\"endpoint\\" in values && values.endpoint != null) { @@ -59084,9 +64227,10 @@ endpoints?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -59165,6 +64309,55 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: DidService, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#serviceEndpoint\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DidService).#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#serviceEndpoint\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A network address, such as an HTTP URL, at which services operate on behalf * of a DID subject. @@ -59227,6 +64420,7 @@ get endpoints(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -59302,6 +64496,8 @@ get endpoints(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/did#serviceEndpoint\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -59470,6 +64666,16 @@ get endpoints(): (URL)[] { } instance.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + DidService.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -59618,6 +64824,10 @@ endpoints?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -59668,9 +64878,10 @@ endpoints?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -59813,6 +65024,8 @@ endpoints?: (URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/did#serviceEndpoint\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -59945,6 +65158,9 @@ endpoints?: (URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Export)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -59952,6 +65168,16 @@ endpoints?: (URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Export.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -60014,7 +65240,7 @@ endpoints?: (URL)[];} * verify the identity of the actor and the integrity of the data. * */ -export class DataIntegrityProof { +export class DataIntegrityProof implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -60030,6 +65256,14 @@ export class DataIntegrityProof { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -60221,6 +65455,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -60260,6 +65498,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < vocabSparseArrayMinimumLength ? this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice() : vocabCopyPropertyArray(this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite); if (\\"cryptosuite\\" in values && values.cryptosuite != null) { @@ -60352,9 +65591,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -60454,6 +65694,175 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: DataIntegrityProof, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/security#cryptosuite\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#cryptosuite\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#verificationMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#verificationMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#proofPurpose\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { + + let element = ( +{ + \\"@id\\": \\"https://w3id.org/security#\\" + v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#proofPurpose\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#proofValue\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { + + let element = ( +{ + \\"@type\\": \\"https://w3id.org/security#multibase\\", + \\"@value\\": new TextDecoder().decode(encodeMultibase(\\"base58btc\\", v)), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#proofValue\\", descriptor); + + descriptor = { + canonicalIri: \\"http://purl.org/dc/terms/created\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://purl.org/dc/terms/created\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The cryptographic suite used to create the proof. * @@ -60942,6 +66351,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { + let element = ( { \\"@value\\": v } ); @@ -60962,8 +66372,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -60982,6 +66397,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { + let element = ( { \\"@id\\": \\"https://w3id.org/security#\\" + v, @@ -61004,6 +66420,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { + let element = ( { \\"@type\\": \\"https://w3id.org/security#multibase\\", @@ -61027,6 +66444,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -61105,6 +66523,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://purl.org/dc/terms/created\\",\\"https://w3id.org/security#cryptosuite\\",\\"https://w3id.org/security#proofPurpose\\",\\"https://w3id.org/security#proofValue\\",\\"https://w3id.org/security#verificationMethod\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -61293,7 +66713,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -61401,6 +66826,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = _3qzP3ukEZoUziK5FEiA1RhU4aqac; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + DataIntegrityProof.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -61576,7 +67011,7 @@ deepCloneDescriptors.set(this.prototype, { }; /** A key owned by an actor. */ -export class CryptographicKey { +export class CryptographicKey implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -61592,6 +67027,14 @@ export class CryptographicKey { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -61742,6 +67185,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -61781,6 +67228,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < vocabSparseArrayMinimumLength ? this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice() : vocabCopyPropertyArray(this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner);clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = vocabCopyTrustSet( this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, @@ -61832,9 +67280,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -61912,6 +67361,102 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: CryptographicKey, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/security#owner\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CryptographicKey).#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#owner\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKeyPem\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CryptographicKey).#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { + + let element = ( +{ \\"@value\\": await exportSpki(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKeyPem\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchOwner( url: URL, @@ -62338,18 +67883,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#owner_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"owner\\", + [\\"https://w3id.org/security#owner\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -62508,8 +68057,29 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -62528,6 +68098,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { + let element = ( { \\"@value\\": await exportSpki(v) } ); @@ -62603,6 +68174,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/security#owner\\",\\"https://w3id.org/security#publicKeyPem\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -62763,23 +68336,48 @@ deepCloneDescriptors.set(this.prototype, { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -62825,6 +68423,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + CryptographicKey.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -62944,7 +68552,7 @@ deepCloneDescriptors.set(this.prototype, { * [1]: https://w3id.org/fep/521a * */ -export class Multikey { +export class Multikey implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -62960,6 +68568,14 @@ export class Multikey { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -63110,6 +68726,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -63149,6 +68769,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < vocabSparseArrayMinimumLength ? this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice() : vocabCopyPropertyArray(this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller);clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = vocabCopyTrustSet( this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, @@ -63200,9 +68821,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -63280,6 +68902,105 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Multikey, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/security#controller\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Multikey).#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#controller\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKeyMultibase\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Multikey).#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { + + let element = ( +{ + \\"@type\\": \\"https://w3id.org/security#multibase\\", + \\"@value\\": await exportMultibaseKey(v), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKeyMultibase\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchController( url: URL, @@ -63706,18 +69427,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#controller_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"controller\\", + [\\"https://w3id.org/security#controller\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -63880,8 +69605,29 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -63900,6 +69646,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { + let element = ( { \\"@type\\": \\"https://w3id.org/security#multibase\\", @@ -63978,6 +69725,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/security#controller\\",\\"https://w3id.org/security#publicKeyMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -64138,23 +69887,48 @@ deepCloneDescriptors.set(this.prototype, { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -64200,6 +69974,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Multikey.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -64416,6 +70200,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -64509,9 +70297,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -64617,6 +70406,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#stipulates\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Agreement).#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#stipulates\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#stipulatesReciprocal\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Agreement).#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#stipulatesReciprocal\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The primary {@link Commitment} associated with the agreement. This * commitment satisfies the primary {@link Intent} of the corresponding @@ -64757,8 +70614,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -64777,8 +70639,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -64863,6 +70730,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/valueflows/ont/vf#stipulates\\",\\"https://w3id.org/valueflows/ont/vf#stipulatesReciprocal\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -64995,6 +70864,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Agreement)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -65017,7 +70889,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Commitment.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65049,7 +70926,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Commitment.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65066,6 +70948,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = _4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Agreement.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -65170,7 +71062,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; * specifies the actual amount of the economic resource being committed. * */ -export class Commitment { +export class Commitment implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -65186,6 +71078,14 @@ export class Commitment { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -65331,6 +71231,10 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -65370,6 +71274,7 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length < vocabSparseArrayMinimumLength ? this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice() : vocabCopyPropertyArray(this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies); if (\\"satisfies\\" in values && values.satisfies != null) { @@ -65415,9 +71320,10 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -65517,6 +71423,86 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Commitment, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#satisfies\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Commitment).#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#satisfies\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Commitment).#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The {@link Intent} of a {@link Proposal} that this commitment * satisfies. The value is the proposal's URI with a @@ -65639,6 +71625,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -65659,8 +71646,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -65734,6 +71726,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\",\\"https://w3id.org/valueflows/ont/vf#satisfies\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -65913,7 +71907,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65930,6 +71929,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Commitment.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -66047,7 +72056,7 @@ deepCloneDescriptors.set(this.prototype, { * in a {@link Proposal}. * */ -export class Intent { +export class Intent implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -66063,6 +72072,14 @@ export class Intent { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -66250,6 +72267,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -66289,6 +72310,7 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < vocabSparseArrayMinimumLength ? this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice() : vocabCopyPropertyArray(this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action); if (\\"action\\" in values && values.action != null) { @@ -66376,9 +72398,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -66522,6 +72545,175 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Intent, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#action\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#action\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#resourceConformsTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#resourceConformsTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#availableQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#availableQuantity\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#minimumQuantity\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#minimumQuantity\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The type of economic transaction. The value of this property should be * either \`\\"deliverService\\"\` or \`\\"transfer\\"\`. @@ -66737,6 +72929,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) { + let element = ( { \\"@value\\": v } ); @@ -66757,6 +72950,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -66777,8 +72971,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66797,8 +72996,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66817,8 +73021,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66892,6 +73101,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://w3id.org/valueflows/ont/vf#action\\",\\"https://w3id.org/valueflows/ont/vf#availableQuantity\\",\\"https://w3id.org/valueflows/ont/vf#minimumQuantity\\",\\"https://w3id.org/valueflows/ont/vf#resourceConformsTo\\",\\"https://w3id.org/valueflows/ont/vf#resourceQuantity\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -67101,7 +73312,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67133,7 +73349,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67165,7 +73386,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67182,6 +73408,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Intent.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -67486,6 +73722,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -67607,9 +73847,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -67715,6 +73956,128 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#purpose\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#purpose\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#publishes\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#publishes\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#reciprocal\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#reciprocal\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/valueflows/ont/vf#unitBased\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/valueflows/ont/vf#unitBased\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The type of proposal. Possible values are \`\\"offer\\"\` and \`\\"request\\"\`. * @@ -67914,6 +74277,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) { + let element = ( { \\"@value\\": v } ); @@ -67934,8 +74298,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -67954,8 +74323,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -67974,6 +74348,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) { + let element = ( { \\"@value\\": v } ); @@ -68060,6 +74435,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/valueflows/ont/vf#publishes\\",\\"https://w3id.org/valueflows/ont/vf#purpose\\",\\"https://w3id.org/valueflows/ont/vf#reciprocal\\",\\"https://w3id.org/valueflows/ont/vf#unitBased\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -68192,6 +74569,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Proposal)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -68244,7 +74624,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -68276,7 +74661,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -68322,6 +74712,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Proposal.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -68532,6 +74932,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -68603,9 +75007,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -68780,6 +75185,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -68916,6 +75323,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Accept)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -68923,6 +75333,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Accept.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -69054,6 +75474,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -69125,9 +75549,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -69302,6 +75727,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -69434,6 +75861,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Add)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -69441,6 +75871,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Add.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -69571,6 +76011,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -69642,9 +76086,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -69819,6 +76264,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -69951,6 +76398,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Announce)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -69958,6 +76408,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Announce.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -70821,6 +77281,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -71646,9 +78110,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -72090,6 +78555,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -72479,18 +79755,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -72640,18 +79920,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -73064,18 +80348,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -73229,18 +80517,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -73723,18 +81015,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -74167,18 +81463,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -74591,18 +81891,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -75018,18 +82322,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -75443,18 +82751,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -75866,18 +83178,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -76289,18 +83605,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -76709,18 +84029,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -77133,18 +84457,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -77699,18 +85027,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78182,18 +85514,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78347,18 +85683,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78771,18 +86111,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -78936,18 +86280,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -79624,6 +86972,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -79647,8 +86996,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79667,8 +87021,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79687,6 +87046,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -79707,6 +87067,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -79727,8 +87088,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79747,8 +87117,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79767,8 +87146,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79787,8 +87171,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79807,8 +87196,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79827,8 +87221,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79847,8 +87246,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79867,8 +87271,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79887,8 +87296,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79907,8 +87321,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79927,6 +87346,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -79947,6 +87367,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -79967,6 +87388,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -79987,6 +87409,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -80007,6 +87430,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -80027,8 +87451,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80047,8 +87492,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80067,8 +87533,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80087,6 +87558,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -80107,6 +87579,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -80127,6 +87600,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -80228,6 +87702,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -80360,6 +87836,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Application)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -80424,7 +87903,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80465,7 +87949,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80566,11 +88055,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -80613,11 +88112,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -80658,7 +88167,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80699,7 +88213,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80740,7 +88259,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80781,7 +88305,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80822,7 +88351,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80863,7 +88397,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80904,7 +88443,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80936,7 +88480,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -81124,23 +88673,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -81182,23 +88756,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -81239,7 +88838,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -81344,6 +88948,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Application.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -82034,6 +89648,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -82105,9 +89723,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -82282,6 +89901,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -82426,6 +90047,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof IntransitiveActivity)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -82433,6 +90057,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + IntransitiveActivity.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -82563,6 +90197,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -82634,9 +90272,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -82811,6 +90450,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -82943,6 +90584,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Arrive)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -82950,6 +90594,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Arrive.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -83117,6 +90771,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -83230,9 +90888,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -83360,6 +91019,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -83729,18 +91485,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -84173,18 +91933,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -84360,8 +92124,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -84380,6 +92149,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -84404,8 +92174,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -84490,6 +92265,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -84622,6 +92399,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Article)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -84653,7 +92433,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -84733,7 +92518,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -84750,6 +92540,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Article.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -84973,6 +92773,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -85080,9 +92884,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -85136,6 +92941,99 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu }; return deepCloneGraph(this, this.clone(values, cloneOptions)); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#width\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#width\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#height\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#height\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Specifies a hint as to the rendering width in * device-independent pixels of the linked resource. @@ -85299,6 +93197,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -85322,6 +93221,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -85345,6 +93245,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + let element = ( { \\"@value\\": v } ); @@ -85431,6 +93332,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -85579,6 +93482,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Document)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -85674,6 +93580,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } instance.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = _2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Document.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -85855,6 +93771,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -85920,9 +93840,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -86110,6 +94031,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -86242,6 +94165,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Audio)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -86249,6 +94175,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Audio.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -86378,6 +94314,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -86449,9 +94389,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -86626,6 +94567,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -86762,6 +94705,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Ignore)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -86769,6 +94715,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Ignore.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -86900,6 +94856,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -86971,9 +94931,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -87148,6 +95109,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -87280,6 +95243,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Block)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -87287,6 +95253,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Block.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -87459,6 +95435,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -87575,9 +95555,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -87705,6 +95686,105 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#partOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#partOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#next\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#next\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#prev\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#prev\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchPartOf( url: URL, @@ -88073,18 +96153,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#partOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"partOf\\", + [\\"https://www.w3.org/ns/activitystreams#partOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -88492,18 +96576,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#next_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"next\\", + [\\"https://www.w3.org/ns/activitystreams#next\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -88912,18 +97000,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#prev_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"prev\\", + [\\"https://www.w3.org/ns/activitystreams#prev\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -89093,8 +97185,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89113,8 +97210,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89133,8 +97235,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89219,6 +97326,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#next\\",\\"https://www.w3.org/ns/activitystreams#partOf\\",\\"https://www.w3.org/ns/activitystreams#prev\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -89355,6 +97464,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof CollectionPage)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -89386,7 +97498,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89427,7 +97544,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89468,7 +97590,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89485,6 +97612,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + CollectionPage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -89672,6 +97809,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -89743,9 +97884,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -89920,6 +98062,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -90052,6 +98196,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Create)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -90059,6 +98206,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Create.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -90188,6 +98345,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -90259,9 +98420,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -90436,6 +98598,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -90568,6 +98732,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Delete)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -90575,6 +98742,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Delete.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -90702,6 +98879,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -90773,9 +98954,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -90950,6 +99132,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -91082,6 +99266,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Dislike)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -91089,6 +99276,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Dislike.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -91149,7 +99346,7 @@ instruments?: (Object | URL)[];} }; /** Contents of {@link Actor}'s \`endpoints\`. */ -export class Endpoints { +export class Endpoints implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -91165,6 +99362,14 @@ export class Endpoints { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -91380,6 +99585,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -91419,6 +99628,7 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length < vocabSparseArrayMinimumLength ? this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice() : vocabCopyPropertyArray(this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl); if (\\"proxyUrl\\" in values && values.proxyUrl != null) { @@ -91534,9 +99744,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -91746,6 +99957,217 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Endpoints, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#proxyUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#proxyUrl\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#oauthTokenEndpoint\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#oauthTokenEndpoint\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#provideClientKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#provideClientKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#signClientKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#signClientKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#sharedInbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#sharedInbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#uploadMedia\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#uploadMedia\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Endpoint URI so this actor's clients may access remote ActivityStreams * objects which require authentication to access. To use this endpoint, @@ -92036,6 +100458,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92056,6 +100479,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92076,6 +100500,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92096,6 +100521,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92116,6 +100542,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92136,6 +100563,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92156,6 +100584,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -92231,6 +100660,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint\\",\\"https://www.w3.org/ns/activitystreams#oauthTokenEndpoint\\",\\"https://www.w3.org/ns/activitystreams#provideClientKey\\",\\"https://www.w3.org/ns/activitystreams#proxyUrl\\",\\"https://www.w3.org/ns/activitystreams#sharedInbox\\",\\"https://www.w3.org/ns/activitystreams#signClientKey\\",\\"https://www.w3.org/ns/activitystreams#uploadMedia\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -92569,6 +101000,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = _KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Endpoints.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -92845,6 +101286,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -92910,9 +101355,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -93100,6 +101546,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -93232,6 +101680,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Event)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -93239,6 +101690,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Event.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -93369,6 +101830,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -93440,9 +101905,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -93617,6 +102083,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -93749,6 +102217,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Flag)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -93756,6 +102227,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Flag.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -93887,6 +102368,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -93958,9 +102443,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -94135,6 +102621,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -94267,6 +102755,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Follow)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -94274,6 +102765,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Follow.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -95137,6 +103638,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -95962,9 +104467,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -96406,6 +104912,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -96795,18 +106112,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -96956,18 +106277,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -97380,18 +106705,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -97545,18 +106874,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -98039,18 +107372,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -98483,18 +107820,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -98907,18 +108248,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -99334,18 +108679,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -99759,18 +109108,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -100182,18 +109535,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -100605,18 +109962,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -101025,18 +110386,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -101449,18 +110814,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -102015,18 +111384,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -102498,18 +111871,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -102663,18 +112040,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -103087,18 +112468,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -103252,18 +112637,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -103940,6 +113329,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -103963,8 +113353,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -103983,8 +113378,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104003,6 +113403,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -104023,6 +113424,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -104043,8 +113445,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104063,8 +113474,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104083,8 +113503,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104103,8 +113528,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104123,8 +113553,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104143,8 +113578,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104163,8 +113603,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104183,8 +113628,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104203,8 +113653,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104223,8 +113678,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104243,6 +113703,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -104263,6 +113724,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -104283,6 +113745,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -104303,6 +113766,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -104323,6 +113787,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -104343,8 +113808,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104363,8 +113849,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104383,8 +113890,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104403,6 +113915,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -104423,6 +113936,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -104443,6 +113957,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -104544,6 +114059,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -104676,6 +114193,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Group)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -104740,7 +114260,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -104781,7 +114306,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -104882,11 +114412,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -104929,11 +114469,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -104974,7 +114524,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105015,7 +114570,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105056,7 +114616,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105097,7 +114662,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105138,7 +114708,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105179,7 +114754,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105220,7 +114800,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105252,7 +114837,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105440,23 +115030,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -105498,23 +115113,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -105555,7 +115195,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105660,6 +115305,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Group.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -106288,7 +115943,7 @@ get attributionDomains(): (string)[] { * the resource. * */ -export class Link { +export class Link implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -106304,6 +115959,14 @@ export class Link { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -106713,6 +116376,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -106754,6 +116421,7 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length < vocabSparseArrayMinimumLength ? this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice() : vocabCopyPropertyArray(this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href); if (\\"href\\" in values && values.href != null) { @@ -107062,9 +116730,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -107188,6 +116857,317 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Link, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#href\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#href\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#rel\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#rel\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#mediaType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#mediaType\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#name\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#name\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#hreflang\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang) { + + let element = ( +{ \\"@value\\": v.baseName } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#hreflang\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#height\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#height\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#width\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#width\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preview\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preview\\", descriptor); + + descriptor = { + canonicalIri: \\"http://purl.org/dc/terms/license\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://purl.org/dc/terms/license\\", descriptor); +descriptors.set(\\"https://schema.org/license\\", descriptor); +descriptors.set(\\"http://creativecommons.org/ns#license\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The target resource pointed to by a {@link Link}. */ @@ -107718,18 +117698,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#preview_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"preview\\", + [\\"https://www.w3.org/ns/activitystreams#preview\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -108013,6 +117997,7 @@ get licenses(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -108033,6 +118018,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel) { + let element = ( { \\"@value\\": v } ); @@ -108053,6 +118039,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { \\"@value\\": v } ); @@ -108073,6 +118060,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + let element = ( { \\"@value\\": v } ); @@ -108093,6 +118081,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -108116,6 +118105,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang) { + let element = ( { \\"@value\\": v.baseName } ); @@ -108136,6 +118126,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -108159,6 +118150,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -108182,8 +118174,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -108202,6 +118203,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -108287,6 +118289,8 @@ get licenses(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://purl.org/dc/terms/license\\",\\"https://schema.org/license\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#href\\",\\"https://www.w3.org/ns/activitystreams#hreflang\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#rel\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -108695,12 +118699,22 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -108754,6 +118768,16 @@ get licenses(): (URL)[] { } instance.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = _2rzkBRS4gNPrkJk9DohHAMUAxA2d; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Link.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -109095,6 +119119,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -109146,9 +119174,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -109311,6 +119340,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://purl.org/dc/terms/license\\",\\"https://schema.org/license\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#href\\",\\"https://www.w3.org/ns/activitystreams#hreflang\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#rel\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -109443,6 +119474,9 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Hashtag)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -109450,6 +119484,16 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Hashtag.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -109571,6 +119615,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -109636,9 +119684,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -109826,6 +119875,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -109958,6 +120009,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Image)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -109965,6 +120019,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Image.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -110095,6 +120159,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -110166,9 +120234,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -110343,6 +120412,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -110479,6 +120550,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Offer)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -110486,6 +120560,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Offer.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -110615,6 +120699,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -110686,9 +120774,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -110863,6 +120952,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -110995,6 +121086,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Invite)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -111002,6 +121096,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Invite.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -111131,6 +121235,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -111202,9 +121310,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -111379,6 +121488,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -111511,6 +121622,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Join)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -111518,6 +121632,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Join.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -111647,6 +121771,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -111718,9 +121846,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -111895,6 +122024,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -112027,6 +122158,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Leave)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -112034,6 +122168,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Leave.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -112163,6 +122307,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -112234,9 +122382,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -112411,6 +122560,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -112543,6 +122694,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Like)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -112550,6 +122704,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Like.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -112677,6 +122841,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -112748,9 +122916,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -112925,6 +123094,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -113057,6 +123228,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Listen)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -113064,6 +123238,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Listen.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -113171,6 +123355,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -113222,9 +123410,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -113387,6 +123576,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://purl.org/dc/terms/license\\",\\"https://schema.org/license\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#href\\",\\"https://www.w3.org/ns/activitystreams#hreflang\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#rel\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -113519,6 +123710,9 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Mention)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -113526,6 +123720,16 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Mention.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -113656,6 +123860,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -113727,9 +123935,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -113904,6 +124113,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -114036,6 +124247,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Move)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -114043,6 +124257,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Move.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -114212,6 +124436,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -114325,9 +124553,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -114455,6 +124684,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -114824,18 +125150,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -115268,18 +125598,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -115455,8 +125789,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -115475,6 +125814,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -115499,8 +125839,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -115585,6 +125930,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -115717,6 +126064,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Note)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -115748,7 +126098,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -115828,7 +126183,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -115845,6 +126205,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Note.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -116087,6 +126457,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -116211,9 +126585,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -116297,6 +126672,77 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#items\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollectionPage).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#items\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#startIndex\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollectionPage).#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#startIndex\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchItem( url: URL, @@ -116684,18 +127130,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"orderedItems\\", + [\\"https://www.w3.org/ns/activitystreams#items\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -116858,8 +127308,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -116878,6 +127337,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -116967,6 +127427,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/5711#followersOf\\",\\"https://w3id.org/fep/5711#followingOf\\",\\"https://w3id.org/fep/5711#inboxOf\\",\\"https://w3id.org/fep/5711#likedOf\\",\\"https://w3id.org/fep/5711#likesOf\\",\\"https://w3id.org/fep/5711#outboxOf\\",\\"https://w3id.org/fep/5711#repliesOf\\",\\"https://w3id.org/fep/5711#sharesOf\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#current\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#first\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#items\\",\\"https://www.w3.org/ns/activitystreams#last\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#next\\",\\"https://www.w3.org/ns/activitystreams#partOf\\",\\"https://www.w3.org/ns/activitystreams#prev\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startIndex\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#totalItems\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -117099,6 +127561,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof OrderedCollectionPage)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -117132,12 +127597,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization\\",\\"https://w3id.org/fep/7aa9#FeaturedItem\\",\\"https://w3id.org/valueflows/ont/vf#Agreement\\",\\"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://w3id.org/fep/7aa9#FeatureRequest\\",\\"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://w3id.org/fep/7aa9#FeaturedCollection\\",\\"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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -117183,6 +127658,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = _2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + OrderedCollectionPage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -118088,6 +128573,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -118913,9 +129402,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -119357,6 +129847,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -119746,18 +131047,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -119907,18 +131212,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -120331,18 +131640,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -120496,18 +131809,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -120990,18 +132307,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -121434,18 +132755,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -121858,18 +133183,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -122285,18 +133614,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -122710,18 +134043,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -123133,18 +134470,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -123556,18 +134897,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -123976,18 +135321,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -124400,18 +135749,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -124966,18 +136319,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -125449,18 +136806,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -125614,18 +136975,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -126038,18 +137403,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -126203,18 +137572,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -126891,6 +138264,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -126914,8 +138288,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -126934,8 +138313,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -126954,6 +138338,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -126974,6 +138359,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -126994,8 +138380,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127014,8 +138409,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127034,8 +138438,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127054,8 +138463,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127074,8 +138488,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127094,8 +138513,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127114,8 +138538,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127134,8 +138563,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127154,8 +138588,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127174,8 +138613,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127194,6 +138638,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -127214,6 +138659,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -127234,6 +138680,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -127254,6 +138701,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -127274,6 +138722,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -127294,8 +138743,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127314,8 +138784,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127334,8 +138825,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127354,6 +138850,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -127374,6 +138871,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -127394,6 +138892,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -127495,6 +138994,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -127627,6 +139128,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Organization)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -127691,7 +139195,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127732,7 +139241,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127833,11 +139347,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -127880,11 +139404,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -127925,7 +139459,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127966,7 +139505,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128007,7 +139551,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128048,7 +139597,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128089,7 +139643,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128130,7 +139689,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128171,7 +139735,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128203,7 +139772,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128391,23 +139965,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -128449,23 +140048,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -128506,7 +140130,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128611,6 +140240,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Organization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -129292,6 +140931,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -129357,9 +141000,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -129547,6 +141191,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -129679,6 +141325,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Page)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -129686,6 +141335,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Page.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -130549,6 +142208,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -131374,9 +143037,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -131818,6 +143482,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -132207,18 +144682,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -132368,18 +144847,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -132792,18 +145275,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -132957,18 +145444,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -133451,18 +145942,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -133895,18 +146390,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -134319,18 +146818,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -134746,18 +147249,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -135171,18 +147678,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -135594,18 +148105,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -136017,18 +148532,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -136437,18 +148956,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -136861,18 +149384,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -137427,18 +149954,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -137910,18 +150441,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -138075,18 +150610,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -138499,18 +151038,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -138664,18 +151207,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -139352,6 +151899,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -139375,8 +151923,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139395,8 +151948,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139415,6 +151973,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -139435,6 +151994,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -139455,8 +152015,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139475,8 +152044,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139495,8 +152073,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139515,8 +152098,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139535,8 +152123,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139555,8 +152148,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139575,8 +152173,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139595,8 +152198,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139615,8 +152223,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139635,8 +152248,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139655,6 +152273,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -139675,6 +152294,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -139695,6 +152315,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -139715,6 +152336,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -139735,6 +152357,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -139755,8 +152378,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139775,8 +152419,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139795,8 +152460,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139815,6 +152485,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -139835,6 +152506,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -139855,6 +152527,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -139956,6 +152629,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -140088,6 +152763,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Person)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -140152,7 +152830,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140193,7 +152876,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140294,11 +152982,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140341,11 +153039,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140386,7 +153094,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140427,7 +153140,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140468,7 +153186,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140509,7 +153232,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140550,7 +153278,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140591,7 +153324,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140632,7 +153370,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140664,7 +153407,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140852,23 +153600,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140910,23 +153683,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140967,7 +153765,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -141072,6 +153875,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Person.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -141840,6 +154653,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -141989,9 +154806,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -142075,6 +154893,189 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#accuracy\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#accuracy\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#altitude\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#altitude\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#latitude\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#latitude\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#longitude\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#longitude\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#radius\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#radius\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#units\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units) { + + let element = ( +v == \\"cm\\" || v == \\"feet\\" || v == \\"inches\\" || v == \\"km\\" || v == \\"m\\" || v == \\"miles\\" ?{ \\"@value\\": v } :{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#units\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Indicates the accuracy of position coordinates on a {@link Place} objects. * Expressed in properties of percentage. e.g. \\"94.0\\" means \\"94.0% accurate\\". @@ -142329,6 +155330,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142352,6 +155354,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142375,6 +155378,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142398,6 +155402,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142421,6 +155426,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#float\\", @@ -142444,6 +155450,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units) { + let element = ( v == \\"cm\\" || v == \\"feet\\" || v == \\"inches\\" || v == \\"km\\" || v == \\"m\\" || v == \\"miles\\" ? { \\"@value\\": v } : { \\"@id\\": formatIri(v) } ); @@ -142530,6 +155537,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#accuracy\\",\\"https://www.w3.org/ns/activitystreams#altitude\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#latitude\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#longitude\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#radius\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#units\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -142662,6 +155671,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Place)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -142846,6 +155858,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = _oKrwxU4V8wiKhMW1QEYQibcJh8c_units; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Place.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -143108,6 +156130,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -143190,9 +156216,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -143276,6 +156303,43 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#describes\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Profile).#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#describes\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchDescribes( url: URL, @@ -143644,18 +156708,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#describes_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"describes\\", + [\\"https://www.w3.org/ns/activitystreams#describes\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -143785,8 +156853,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -143871,6 +156944,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#describes\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -144003,6 +157078,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Profile)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -144034,7 +157112,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -144051,6 +157134,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Profile.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -144368,6 +157461,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -144605,9 +157702,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -144785,6 +157883,225 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#oneOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#oneOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#anyOf\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#anyOf\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#closed\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) { + + let element = ( +isTemporalInstant(v) ?{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } :{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#closed\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#votersCount\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", + \\"@value\\": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#votersCount\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quote\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quote\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#quoteUrl\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ \\"@value\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#quoteUrl\\", descriptor); +descriptors.set(\\"https://misskey-hub.net/ns#_misskey_quote\\", descriptor); +descriptors.set(\\"http://fedibird.com/ns#quoteUri\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/044f#quoteAuthorization\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/044f#quoteAuthorization\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchExclusiveOption( url: URL, @@ -145158,18 +158475,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#exclusiveOption_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"oneOf\\", + [\\"https://www.w3.org/ns/activitystreams#oneOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -145585,18 +158906,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#inclusiveOption_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"anyOf\\", + [\\"https://www.w3.org/ns/activitystreams#anyOf\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -146038,18 +159363,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quote\\", + [\\"https://w3id.org/fep/044f#quote\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -146482,18 +159811,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"quoteAuthorization\\", + [\\"https://w3id.org/fep/044f#quoteAuthorization\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -146584,8 +159917,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146604,8 +159942,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146624,6 +159967,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) { + let element = ( isTemporalInstant(v) ? { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -146647,6 +159991,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\\", @@ -146670,8 +160015,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146690,6 +160040,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { \\"@value\\": formatIri(v) } ); @@ -146714,8 +160065,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146800,6 +160156,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://fedibird.com/ns#quoteUri\\",\\"http://joinmastodon.org/ns#votersCount\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_quote\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/044f#quote\\",\\"https://w3id.org/fep/044f#quoteAuthorization\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#anyOf\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#closed\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#oneOf\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#quoteUrl\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -146932,6 +160290,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Question)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -146963,7 +160324,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147004,7 +160370,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147113,7 +160484,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147193,7 +160569,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147210,6 +160591,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Question.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -147482,6 +160873,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -147553,9 +160948,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -147730,6 +161126,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -147862,6 +161260,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Read)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -147869,6 +161270,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Read.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -147998,6 +161409,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -148069,9 +161484,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -148246,6 +161662,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -148382,6 +161800,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Reject)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -148389,6 +161810,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Reject.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -148665,6 +162096,10 @@ relationships?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -148883,9 +162318,10 @@ relationships?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -149015,6 +162451,105 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#subject\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#subject\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#object\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#object\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#relationship\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#relationship\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchSubject( url: URL, @@ -149385,18 +162920,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#subject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"subject\\", + [\\"https://www.w3.org/ns/activitystreams#subject\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -149805,18 +163344,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#object_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -149967,18 +163510,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#object_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"object\\", + [\\"https://www.w3.org/ns/activitystreams#object\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -150390,18 +163937,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#relationship_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"relationship\\", + [\\"https://www.w3.org/ns/activitystreams#relationship\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -150554,18 +164105,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#relationship_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"relationship\\", + [\\"https://www.w3.org/ns/activitystreams#relationship\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -150736,8 +164291,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150756,8 +164316,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150776,8 +164341,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150862,6 +164432,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#relationship\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#subject\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -150994,6 +164566,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Relationship)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -151025,7 +164600,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151066,7 +164646,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151107,7 +164692,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151124,6 +164714,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Relationship.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -151325,6 +164925,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -151396,9 +165000,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -151573,6 +165178,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -151705,6 +165312,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Remove)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -151712,6 +165322,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Remove.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -152575,6 +166195,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -153400,9 +167024,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -153844,6 +167469,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#preferredUsername\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#preferredUsername\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#publicKey\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#publicKey\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/security#assertionMethod\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/security#assertionMethod\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/ef61/gateways\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ \\"@id\\": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { \\"@list\\": array }; + }, + }; + descriptors.set(\\"https://w3id.org/fep/ef61/gateways\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\", descriptor); + + descriptor = { + canonicalIri: \\"http://www.w3.org/ns/ldp#inbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://www.w3.org/ns/ldp#inbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#outbox\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#outbox\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#following\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#following\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#followers\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#followers\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#liked\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#liked\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featured\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featured\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#featuredTags\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#featuredTags\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/7aa9#featuredCollections\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/7aa9#featuredCollections\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#streams\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#streams\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#endpoints\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#endpoints\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#discoverable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#discoverable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#suspended\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#suspended\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#memorial\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#memorial\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#indexable\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#indexable\\", descriptor); + + descriptor = { + canonicalIri: \\"http://joinmastodon.org/ns#attributionDomains\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"http://joinmastodon.org/ns#attributionDomains\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#movedTo\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#movedTo\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/did#service\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { \\"@id\\": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/did#service\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#_misskey_followedMessage\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#_misskey_followedMessage\\", descriptor); + + descriptor = { + canonicalIri: \\"https://misskey-hub.net/ns#isCat\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://misskey-hub.net/ns#isCat\\", descriptor); + + descriptor = { + canonicalIri: \\"https://w3id.org/fep/6757#preferredLicense\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ \\"@id\\": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://w3id.org/fep/6757#preferredLicense\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -154233,18 +168669,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -154394,18 +168834,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"publicKey\\", + [\\"https://w3id.org/security#publicKey\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -154818,18 +169262,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -154983,18 +169431,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"assertionMethod\\", + [\\"https://w3id.org/security#assertionMethod\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -155477,18 +169929,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"inbox\\", + [\\"http://www.w3.org/ns/ldp#inbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -155921,18 +170377,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"outbox\\", + [\\"https://www.w3.org/ns/activitystreams#outbox\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -156345,18 +170805,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"following\\", + [\\"https://www.w3.org/ns/activitystreams#following\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -156772,18 +171236,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"followers\\", + [\\"https://www.w3.org/ns/activitystreams#followers\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -157197,18 +171665,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"liked\\", + [\\"https://www.w3.org/ns/activitystreams#liked\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -157620,18 +172092,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featured\\", + [\\"http://joinmastodon.org/ns#featured\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -158043,18 +172519,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredTags\\", + [\\"http://joinmastodon.org/ns#featuredTags\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -158463,18 +172943,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"featuredCollections\\", + [\\"https://w3id.org/fep/7aa9#featuredCollections\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -158887,18 +173371,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"streams\\", + [\\"https://www.w3.org/ns/activitystreams#streams\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -159453,18 +173941,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"movedTo\\", + [\\"https://www.w3.org/ns/activitystreams#movedTo\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -159936,18 +174428,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -160101,18 +174597,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"alsoKnownAs\\", + [\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -160525,18 +175025,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === \\"object\\" && \\"@context\\" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -160690,18 +175194,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === \\"object\\" && \\"@context\\" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === \\"http:\\" || - this.id.protocol === \\"https:\\") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd[\\"@context\\"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + \\"service\\", + [\\"https://www.w3.org/ns/did#service\\"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger([\\"fedify\\", \\"vocab\\"]).debug( @@ -161378,6 +175886,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -161401,8 +175910,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161421,8 +175935,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161441,6 +175960,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { \\"@id\\": v.origin } ); @@ -161461,6 +175981,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { \\"@value\\": v } ); @@ -161481,8 +176002,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161501,8 +176031,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161521,8 +176060,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161541,8 +176085,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161561,8 +176110,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161581,8 +176135,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161601,8 +176160,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161621,8 +176185,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161641,8 +176210,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161661,8 +176235,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161681,6 +176260,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { \\"@value\\": v } ); @@ -161701,6 +176281,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { \\"@value\\": v } ); @@ -161721,6 +176302,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { \\"@value\\": v } ); @@ -161741,6 +176323,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { \\"@value\\": v } ); @@ -161761,6 +176344,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { \\"@value\\": v } ); @@ -161781,8 +176365,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161801,8 +176406,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161821,8 +176447,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { \\"@id\\": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161841,6 +176472,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { \\"@value\\": v } ); @@ -161861,6 +176493,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { \\"@value\\": v } ); @@ -161881,6 +176514,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { \\"@id\\": formatIri(v) } ); @@ -161982,6 +176616,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://joinmastodon.org/ns#attributionDomains\\",\\"http://joinmastodon.org/ns#discoverable\\",\\"http://joinmastodon.org/ns#featured\\",\\"http://joinmastodon.org/ns#featuredTags\\",\\"http://joinmastodon.org/ns#indexable\\",\\"http://joinmastodon.org/ns#memorial\\",\\"http://joinmastodon.org/ns#suspended\\",\\"http://purl.org/dc/terms/license\\",\\"http://www.w3.org/ns/ldp#inbox\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://misskey-hub.net/ns#_misskey_followedMessage\\",\\"https://misskey-hub.net/ns#isCat\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/fep/6757#preferredLicense\\",\\"https://w3id.org/fep/7aa9#featuredCollections\\",\\"https://w3id.org/fep/ef61/gateways\\",\\"https://w3id.org/security#assertionMethod\\",\\"https://w3id.org/security#proof\\",\\"https://w3id.org/security#publicKey\\",\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#endpoints\\",\\"https://www.w3.org/ns/activitystreams#followers\\",\\"https://www.w3.org/ns/activitystreams#following\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#liked\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#movedTo\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#outbox\\",\\"https://www.w3.org/ns/activitystreams#preferredUsername\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#streams\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/did#service\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -162114,6 +176750,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Service)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -162178,7 +176817,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162219,7 +176863,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162320,11 +176969,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162367,11 +177026,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v[\\"@type\\"])&& [\\"https://www.w3.org/ns/activitystreams#OrderedCollection\\",\\"https://w3id.org/fep/7aa9#FeaturedCollection\\"].some( t => v[\\"@type\\"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162412,7 +177081,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162453,7 +177127,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162494,7 +177173,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162535,7 +177219,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162576,7 +177265,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162617,7 +177311,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162658,7 +177357,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162690,7 +177394,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162878,23 +177587,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162936,23 +177670,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162993,7 +177752,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -163098,6 +177862,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Service.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -163718,7 +178492,7 @@ get attributionDomains(): (string)[] { }; /** Contents of {@link Object}'s \`source\`. */ -export class Source { +export class Source implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -163734,6 +178508,14 @@ export class Source { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get \\"~fedify.vocab\\"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -163927,6 +178709,10 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -163967,6 +178753,7 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if (\\"content\\" in values && values.content != null) { @@ -164059,9 +178846,10 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -164118,6 +178906,85 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Source, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#content\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Source).#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + + let element = ( +typeof v === \\"string\\" ?{ \\"@value\\": v } :{ + \\"@value\\": v.toString(), + \\"@language\\": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#content\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#mediaType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Source).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ \\"@value\\": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#mediaType\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The source content. */ @@ -164237,6 +179104,7 @@ get contents(): ((string | LanguageString))[] { const values: Record = {}; array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + let element = ( typeof v === \\"string\\" ? { \\"@value\\": v } : { \\"@value\\": v.toString(), @@ -164260,6 +179128,7 @@ get contents(): ((string | LanguageString))[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { \\"@value\\": v } ); @@ -164340,6 +179209,8 @@ get contents(): ((string | LanguageString))[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -164538,6 +179409,16 @@ get contents(): ((string | LanguageString))[] { } instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Source.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -164728,6 +179609,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -164799,9 +179684,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -164976,6 +179862,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -165108,6 +179996,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof TentativeAccept)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -165115,6 +180006,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + TentativeAccept.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -165244,6 +180145,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -165315,9 +180220,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -165492,6 +180398,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -165624,6 +180532,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof TentativeReject)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -165631,6 +180542,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + TentativeReject.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -165831,6 +180752,10 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -165972,9 +180897,10 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -166029,6 +180955,69 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} }; return deepCloneGraph(this, this.clone(values, cloneOptions)); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#formerType\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Tombstone).#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType) { + + let element = ( +{ \\"@id\\": v.typeId.href } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#formerType\\", descriptor); + + descriptor = { + canonicalIri: \\"https://www.w3.org/ns/activitystreams#deleted\\", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: \\"expand\\"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Tombstone).#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted) { + + let element = ( +{ + \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", + \\"@value\\": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === \\"undefined\\") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set(\\"https://www.w3.org/ns/activitystreams#deleted\\", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** On a \`Tombstone\` object, the \`formerType\` property identifies the type of * the object that was deleted. @@ -166167,6 +181156,7 @@ get formerTypes(): ($EntityType)[] { array = []; for (const v of this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType) { + let element = ( { \\"@id\\": v.typeId.href } ); @@ -166187,6 +181177,7 @@ get formerTypes(): ($EntityType)[] { array = []; for (const v of this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted) { + let element = ( { \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\", @@ -166281,6 +181272,8 @@ get formerTypes(): ($EntityType)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#deleted\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#formerType\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -166413,6 +181406,9 @@ get formerTypes(): ($EntityType)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Tombstone)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -166495,6 +181491,16 @@ get formerTypes(): ($EntityType)[] { } instance.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Tombstone.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -166672,6 +181678,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -166743,9 +181753,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -166920,6 +181931,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -167052,6 +182065,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Travel)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -167059,6 +182075,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Travel.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -167193,6 +182219,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -167264,9 +182294,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -167441,6 +182472,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -167573,6 +182606,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Undo)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -167580,6 +182616,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Undo.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -167712,6 +182758,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -167783,9 +182833,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -167960,6 +183011,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -168092,6 +183145,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Update)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -168099,6 +183155,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Update.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -168220,6 +183286,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -168285,9 +183355,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -168475,6 +183546,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#height\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\",\\"https://www.w3.org/ns/activitystreams#width\\",\\"https://www.w3.org/ns/credentials/v2#digestMultibase\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -168607,6 +183680,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Video)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -168614,6 +183690,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Video.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -168742,6 +183828,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -168813,9 +183903,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -168990,6 +184081,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set([\\"http://creativecommons.org/ns#license\\",\\"http://fedibird.com/ns#emojiReactions\\",\\"http://purl.org/dc/terms/license\\",\\"https://gotosocial.org/ns#announceAuthorization\\",\\"https://gotosocial.org/ns#approvedBy\\",\\"https://gotosocial.org/ns#interactionPolicy\\",\\"https://gotosocial.org/ns#likeAuthorization\\",\\"https://gotosocial.org/ns#replyAuthorization\\",\\"https://schema.org/license\\",\\"https://w3id.org/fep/22cd#translations\\",\\"https://w3id.org/security#proof\\",\\"https://www.w3.org/ns/activitystreams#actor\\",\\"https://www.w3.org/ns/activitystreams#attachment\\",\\"https://www.w3.org/ns/activitystreams#attributedTo\\",\\"https://www.w3.org/ns/activitystreams#audience\\",\\"https://www.w3.org/ns/activitystreams#bcc\\",\\"https://www.w3.org/ns/activitystreams#bto\\",\\"https://www.w3.org/ns/activitystreams#cc\\",\\"https://www.w3.org/ns/activitystreams#content\\",\\"https://www.w3.org/ns/activitystreams#context\\",\\"https://www.w3.org/ns/activitystreams#duration\\",\\"https://www.w3.org/ns/activitystreams#endTime\\",\\"https://www.w3.org/ns/activitystreams#generator\\",\\"https://www.w3.org/ns/activitystreams#icon\\",\\"https://www.w3.org/ns/activitystreams#image\\",\\"https://www.w3.org/ns/activitystreams#inReplyTo\\",\\"https://www.w3.org/ns/activitystreams#instrument\\",\\"https://www.w3.org/ns/activitystreams#likes\\",\\"https://www.w3.org/ns/activitystreams#location\\",\\"https://www.w3.org/ns/activitystreams#mediaType\\",\\"https://www.w3.org/ns/activitystreams#name\\",\\"https://www.w3.org/ns/activitystreams#object\\",\\"https://www.w3.org/ns/activitystreams#origin\\",\\"https://www.w3.org/ns/activitystreams#preview\\",\\"https://www.w3.org/ns/activitystreams#published\\",\\"https://www.w3.org/ns/activitystreams#replies\\",\\"https://www.w3.org/ns/activitystreams#result\\",\\"https://www.w3.org/ns/activitystreams#sensitive\\",\\"https://www.w3.org/ns/activitystreams#shares\\",\\"https://www.w3.org/ns/activitystreams#source\\",\\"https://www.w3.org/ns/activitystreams#startTime\\",\\"https://www.w3.org/ns/activitystreams#summary\\",\\"https://www.w3.org/ns/activitystreams#tag\\",\\"https://www.w3.org/ns/activitystreams#target\\",\\"https://www.w3.org/ns/activitystreams#to\\",\\"https://www.w3.org/ns/activitystreams#updated\\",\\"https://www.w3.org/ns/activitystreams#url\\"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -169122,6 +184215,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof View)) { throw new TypeError(\\"Unexpected type: \\" + instance.constructor.name); @@ -169129,6 +184225,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !(\\"_retainsRawProperties\\" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + View.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap index a996f64c1..2eff2578d 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap @@ -27,7 +27,9 @@ import { parseIri, parseJsonLdId, type PortableObjectVerifier, - type RemoteDocument + type RawPropertyValue, + type RemoteDocument, + type VocabularyObject } from "@fedify/vocab-runtime"; import { compactJsonLdCache, @@ -56,6 +58,16 @@ import { rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject } from "@fedify/vocab-runtime/internal/portable-dereference"; +import { + createRawPropertyEncodingOptions, + encodeNestedVocabularyValue, + expandRawPropertyValue, + RAW_PROPERTY_PROTOCOL, + type RawPropertyRequest, + readRawPropertyValues, + retainRawProperties, + type RetainedRawProperties +} from "@fedify/vocab-runtime/internal/raw-property"; import { enterSignedValueScope, resolveSignedValues, @@ -369,6 +381,289 @@ function deepCloneGraph(source: object, root: T): T { return root; } +type RawPropertyEncoder = ( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, +) => Promise; + +interface RawPropertyDescriptor { + readonly canonicalIri: string; + readonly encode: RawPropertyEncoder; +} + +// Unknown properties retained while decoding, keyed by the decoded object: +const retainedRawProperties = new WeakMap(); + +// Encoders of the properties each generated class declares, keyed by the +// class's prototype and then by the property IRIs, including aliases: +const rawPropertyDescriptors = new Map< + object, + ReadonlyMap +>(); + +function getRawPropertyDescriptor( + object: object, + iri: string, +): RawPropertyDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(object); + while (prototype != null) { + const descriptor = rawPropertyDescriptors.get(prototype)?.get(iri); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function copyRawProperties(source: object, destination: object): void { + const retained = retainedRawProperties.get(source); + if (retained == null) retainedRawProperties.delete(destination); + else retainedRawProperties.set(destination, retained); +} + +// The contexts in effect for the cached JSON-LD of embedded objects, which +// stays as it was received, keyed by the objects. Telling which keys of such +// a document are which properties takes the contexts of its parents as well: +const cachedJsonLdContexts = new WeakMap(); + +function getCachedJsonLdContext(object: object, context: unknown): unknown { + return cachedJsonLdContexts.has(object) + ? cachedJsonLdContexts.get(object) + : context; +} + +// Objects that were given the document they were received as: +const receivedJsonLd = new WeakSet(); + +// Gives an embedded object, decoded along with the whole document, the document +// it was received as, which toJsonLd() has to return as is, as a proof can +// cover it. The object is not decoded from that document, since an embedded +// document alone cannot rebuild what its parents' contexts contributed to it, +// such as type-scoped and property-scoped contexts: +function keepReceivedJsonLd( + object: unknown, + document: object, + parentContext: unknown, +): void { + if ( + object == null || typeof object !== "object" || + !(RAW_PROPERTY_PROTOCOL in object) || receivedJsonLd.has(object) + ) { + return; + } + receivedJsonLd.add(object); + (object as unknown as { _cachedJsonLd?: unknown })._cachedJsonLd = + structuredClone(document); + const own = (document as { "@context"?: unknown })["@context"]; + cachedJsonLdContexts.set(object, [ + ...(globalThis.Array.isArray(parentContext) + ? parentContext + : [parentContext]), + ...(globalThis.Array.isArray(own) ? own : [own]), + ]); +} + +// The results of isCachedPropertyKey(), keyed by the document and then by the +// key: +const cachedPropertyKeys = new WeakMap>>(); + +async function expandTopLevelKeys( + document: Record, + contextLoader: DocumentLoader, +): Promise { + const expanded = await jsonld.expand(document, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + return globalThis.Object.keys(expanded[0] ?? {}).filter((iri) => + !iri.startsWith("@") + ); +} + +// The number of expansions must not depend on the document, which can come +// from a remote peer, as each of them can load the contexts again: +async function mapsOnlyKeyToProperty( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + const own = await expandTopLevelKeys( + { "@context": context, [key]: [] }, + contextLoader, + ); + if (own.length !== 1 || own[0] !== iris[0]) return false; + // Only the keys matter, so nested values and their contexts are left out, + // while scalars stay for keyword aliases such as id, which require them: + const others: Record = { "@context": context }; + for (const [k, value] of globalThis.Object.entries(document)) { + if (k === key || k.startsWith("@")) continue; + others[k] = value != null && typeof value === "object" ? [] : value; + } + try { + const expanded = await expandTopLevelKeys(others, contextLoader); + return !expanded.some((iri) => iris.includes(iri)); + } catch { + // Some other term could not take the placeholder, so nothing is known: + return false; + } +} + +// Whether the embedded documents under a key of a compacted document are the +// values decoded for a property. The document has to map the key, and no other +// key, to the property, as a context can remap the key or map another term to +// the property, in which case the cached documents cannot be matched with the +// decoded values: +async function isCachedPropertyKey( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + let checks = cachedPropertyKeys.get(document); + if (checks == null) { + checks = new Map(); + cachedPropertyKeys.set(document, checks); + } + const cached = checks.get(key); + if (cached != null) return await cached; + const check = mapsOnlyKeyToProperty( + document, + context, + key, + iris, + contextLoader, + ); + // A failure, such as of the context loader, is not remembered, as another + // call can pass another loader: + const map = checks; + check.catch(() => map.delete(key)); + checks.set(key, check); + return await check; +} + +async function readRawProperty( + object: object, + request: RawPropertyRequest, + contextLoader: DocumentLoader, +): Promise { + const retained = retainedRawProperties.get(object); + for (const iri of request.candidates) { + const descriptor = getRawPropertyDescriptor(object, iri); + if (descriptor != null) { + const value = await descriptor.encode( + object, + createRawPropertyEncodingOptions(request.stack, contextLoader), + ); + return value === undefined ? [] : await expandRawPropertyValue( + descriptor.canonicalIri, + value, + contextLoader, + ); + } + if (retained != null && globalThis.Object.hasOwn(retained, iri)) { + return retained[iri]; + } + } + return []; +} + +/** + * Gets the values of a property of a vocabulary object in expanded JSON-LD, + * looking the property up by its full IRI. This works for properties that + * have no typed accessor as well as for those that do. + * + * *Raw* means untyped expanded JSON-LD values, such as + * \`{ "@value": "Hello" }\` or \`{ "@id": "https://example.com/" }\`, as + * opposed to the values that typed accessors return. It does not mean the + * received document: + * + * - For a property that the object's class has no accessor for, the result + * is the values retained when the object was decoded by \`fromJsonLd()\`. + * Objects constructed locally have none. + * - For a property that the class has an accessor for, including a + * redundant alias of such a property, the result is the current typed + * values encoded back into expanded JSON-LD. It reflects \`clone()\` + * replacements and objects fetched by dereferencing accessors, and it can + * differ from the received values: for example, values that failed to + * decode are missing, and lexical forms such as date-times are + * normalized. When a later release adds an accessor for a property, + * the result for that property switches from the retained values to the + * encoded ones. + * + * The values are not verified in any way, and IRIs in them are never + * dereferenced. Validate them before use, as with any other data received + * from a remote server. The result is a deep copy, so modifying it does not + * affect the object. + * + * The IRI is matched as given, and then as normalized by the WHATWG URL + * parser. Prefixes are never expanded: \`"as:content"\` is a valid IRI with + * the \`as:\` scheme, so it normally matches nothing. An IRI whose scheme is + * not \`http:\` or \`https:\` is therefore logged as a warning under the + * \`["fedify", "vocab"]\` category. + * + * \`\`\`typescript ignore + * const values = await getRawPropertyValues( + * note, + * "https://w3id.org/quantpub#structuredUrl", + * ); + * for (const value of values) { + * if ("@id" in value && typeof value["@id"] === "string") { + * console.log(new URL(value["@id"])); + * } + * } + * \`\`\` + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The values of the property, or an empty array if it has none. + * @throws {TypeError} If \`propertyIri\` is not an absolute IRI, e.g., an + * empty string, a JSON-LD keyword such as \`"@id"\`, a + * blank node identifier, a term, or a relative + * reference; if \`object\` is not a generated vocabulary + * object; or if encoding the values of a known property + * meets a cycle of objects. + * @since 2.5.0 + */ +export function getRawPropertyValues( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + return readRawPropertyValues(object, propertyIri, "getRawPropertyValues"); +} + +/** + * Gets the first value of a property of a vocabulary object in expanded + * JSON-LD, looking the property up by its full IRI. It is equivalent to + * \`(await getRawPropertyValues(object, propertyIri))[0] ?? null\`; see + * {@link getRawPropertyValues} for how the values are obtained. + * + * It does not throw when the property has multiple values. JSON-LD does not + * order the values of a property unless it is a list, so the first value is + * not more significant than the others. A list property has a single value, + * the \`{ "@list": [...] }\` object. + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The first value of the property, or \`null\` if it has none. + * @throws {TypeError} In the same cases as {@link getRawPropertyValues}. + * @since 2.5.0 + */ +export async function getRawPropertyValue( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + const values = await readRawPropertyValues( + object, + propertyIri, + "getRawPropertyValue", + ); + return values[0] ?? null; +} + function isValidLanguageTag(language: string): boolean { try { new Intl.Locale(normalizeLanguageTag(language)); @@ -451,7 +746,7 @@ import * as _ppM0 from "./preprocessors.ts"; * {@link OrderedCollection}. * */ -export class Object { +export class Object implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -467,6 +762,14 @@ export class Object { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -2132,6 +2435,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -2187,6 +2494,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length < vocabSparseArrayMinimumLength ? this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice() : vocabCopyPropertyArray(this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment);clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = vocabCopyTrustSet( this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, @@ -3771,9 +4079,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -4483,6 +4792,1263 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Object, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#attachment", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#attachment", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#attributedTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#attributedTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#audience", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#audience", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#content", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#content", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#context", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#context", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#name", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#name", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#endTime", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#endTime", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#generator", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#generator", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#icon", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#icon", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#image", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#image", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#inReplyTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#inReplyTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#location", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#location", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preview", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preview", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#published", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#published", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#replies", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_7UpwM3JWcXhADcscukEehBorf6k_replies) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#replies", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#shares", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#shares", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#likes", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#likes", descriptor); + + descriptor = { + canonicalIri: "http://fedibird.com/ns#emojiReactions", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://fedibird.com/ns#emojiReactions", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#startTime", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#startTime", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#summary", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#summary", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#tag", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#tag", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#updated", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#updated", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#url", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + + let element = ( +v instanceof URL ?{ "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#url", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#to", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#to", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#bto", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#bto", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#cc", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#cc", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#bcc", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#bcc", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#mediaType", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#mediaType", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#duration", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#duration", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#duration", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#sensitive", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#sensitive", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#source", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#source", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#proof", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push({ "@graph": element }); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#proof", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactionPolicy", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactionPolicy", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#approvedBy", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#approvedBy", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#likeAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#likeAuthorization", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#replyAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#replyAuthorization", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#announceAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#announceAuthorization", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/22cd#translations", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/22cd#translations", descriptor); + + descriptor = { + canonicalIri: "http://purl.org/dc/terms/license", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Object).#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://purl.org/dc/terms/license", descriptor); +descriptors.set("https://schema.org/license", descriptor); +descriptors.set("http://creativecommons.org/ns#license", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchAttachment( url: URL, @@ -4886,18 +6452,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#attachment_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "attachment", + ["https://www.w3.org/ns/activitystreams#attachment"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -5369,18 +6939,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#attribution_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "attributedTo", + ["https://www.w3.org/ns/activitystreams#attributedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -5533,18 +7107,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#attribution_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "attributedTo", + ["https://www.w3.org/ns/activitystreams#attributedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -5955,18 +7533,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#audience_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "audience", + ["https://www.w3.org/ns/activitystreams#audience"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -6118,18 +7700,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#audience_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "audience", + ["https://www.w3.org/ns/activitystreams#audience"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -6593,18 +8179,22 @@ get contents(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#context_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "context", + ["https://www.w3.org/ns/activitystreams#context"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -7075,18 +8665,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#generator_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "generator", + ["https://www.w3.org/ns/activitystreams#generator"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -7520,18 +9114,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#icon_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "icon", + ["https://www.w3.org/ns/activitystreams#icon"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -7684,18 +9282,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#icon_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "icon", + ["https://www.w3.org/ns/activitystreams#icon"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -8129,18 +9731,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#image_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "image", + ["https://www.w3.org/ns/activitystreams#image"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -8293,18 +9899,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#image_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "image", + ["https://www.w3.org/ns/activitystreams#image"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -8730,18 +10340,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#replyTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inReplyTo", + ["https://www.w3.org/ns/activitystreams#inReplyTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -8893,18 +10507,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#replyTarget_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inReplyTo", + ["https://www.w3.org/ns/activitystreams#inReplyTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -9330,18 +10948,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#location_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "location", + ["https://www.w3.org/ns/activitystreams#location"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -9493,18 +11115,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#location_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "location", + ["https://www.w3.org/ns/activitystreams#location"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -9929,18 +11555,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#preview_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "preview", + ["https://www.w3.org/ns/activitystreams#preview"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -10091,18 +11721,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#preview_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "preview", + ["https://www.w3.org/ns/activitystreams#preview"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -10526,18 +12160,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#replies_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "replies", + ["https://www.w3.org/ns/activitystreams#replies"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -10953,18 +12591,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#shares_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "shares", + ["https://www.w3.org/ns/activitystreams#shares"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -11380,18 +13022,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#likes_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "likes", + ["https://www.w3.org/ns/activitystreams#likes"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -11801,18 +13447,22 @@ get names(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#emojiReactions_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "emojiReactions", + ["http://fedibird.com/ns#emojiReactions"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -12283,18 +13933,22 @@ get summaries(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#tag_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "tag", + ["https://www.w3.org/ns/activitystreams#tag"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -12739,18 +14393,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#to_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "to", + ["https://www.w3.org/ns/activitystreams#to"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -12902,18 +14560,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#to_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "to", + ["https://www.w3.org/ns/activitystreams#to"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -13324,18 +14986,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#bto_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "bto", + ["https://www.w3.org/ns/activitystreams#bto"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -13487,18 +15153,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#bto_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "bto", + ["https://www.w3.org/ns/activitystreams#bto"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -13909,18 +15579,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#cc_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "cc", + ["https://www.w3.org/ns/activitystreams#cc"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -14072,18 +15746,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#cc_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "cc", + ["https://www.w3.org/ns/activitystreams#cc"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -14494,18 +16172,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#bcc_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "bcc", + ["https://www.w3.org/ns/activitystreams#bcc"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -14657,18 +16339,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#bcc_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "bcc", + ["https://www.w3.org/ns/activitystreams#bcc"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -15142,18 +16828,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#proof_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "proof", + ["https://w3id.org/security#proof"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -15304,18 +16994,22 @@ get urls(): ((URL | Link))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#proof_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "proof", + ["https://w3id.org/security#proof"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -15765,18 +17459,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#likeAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "likeAuthorization", + ["https://gotosocial.org/ns#likeAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -16186,18 +17884,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#replyAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "replyAuthorization", + ["https://gotosocial.org/ns#replyAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -16607,18 +18309,22 @@ get urls(): ((URL | Link))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#announceAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "announceAuthorization", + ["https://gotosocial.org/ns#announceAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -17536,8 +19242,21 @@ get licenses(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17556,8 +19275,29 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17576,8 +19316,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17596,6 +19341,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -17619,8 +19365,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17639,6 +19394,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -17662,6 +19418,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -17685,8 +19442,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17705,8 +19471,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17725,8 +19496,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17745,8 +19521,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17765,8 +19550,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17785,8 +19579,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17805,6 +19608,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -17828,8 +19632,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_7UpwM3JWcXhADcscukEehBorf6k_replies) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17848,8 +19657,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17868,8 +19682,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17888,8 +19707,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17908,6 +19732,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -17931,6 +19756,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -17954,8 +19780,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -17974,6 +19809,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -17997,8 +19833,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + let element = ( - v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options) + v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18017,8 +19858,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18037,8 +19883,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18057,8 +19908,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18077,8 +19933,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18097,6 +19958,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { "@value": v } ); @@ -18117,6 +19979,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#duration", @@ -18140,6 +20003,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive) { + let element = ( { "@value": v } ); @@ -18160,8 +20024,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18180,8 +20049,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18200,8 +20074,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18220,6 +20099,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy) { + let element = ( { "@id": formatIri(v) } ); @@ -18240,8 +20120,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18260,8 +20145,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18280,8 +20170,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18300,8 +20195,13 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -18320,6 +20220,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + let element = ( { "@id": formatIri(v) } ); @@ -18441,6 +20342,8 @@ get licenses(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -18874,16 +20777,31 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : typeof v === "object" && "@type" in v && Array.isArray(v["@type"])&& v["@type"].includes("http://schema.org#PropertyValue") ? await PropertyValue.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -18925,23 +20843,48 @@ get licenses(): (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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -18982,7 +20925,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19058,12 +21006,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19172,12 +21130,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19241,7 +21209,12 @@ get licenses(): (URL)[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19305,7 +21278,12 @@ get licenses(): (URL)[] { const decoded = await Image.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19348,12 +21326,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19396,12 +21384,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19444,12 +21442,22 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19523,7 +21531,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19564,7 +21577,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19605,7 +21623,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19646,7 +21669,12 @@ get licenses(): (URL)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19755,12 +21783,22 @@ get licenses(): (URL)[] { && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19829,7 +21867,12 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -19870,7 +21913,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19911,7 +21959,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19952,7 +22005,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -19993,7 +22051,12 @@ get licenses(): (URL)[] { const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20113,7 +22176,12 @@ get licenses(): (URL)[] { const decoded = await Source.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20159,7 +22227,12 @@ get licenses(): (URL)[] { const decoded = await DataIntegrityProof.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20191,7 +22264,12 @@ get licenses(): (URL)[] { const decoded = await InteractionPolicy.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20261,7 +22339,12 @@ get licenses(): (URL)[] { const decoded = await LikeAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20302,7 +22385,12 @@ get licenses(): (URL)[] { const decoded = await ReplyAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20343,7 +22431,12 @@ get licenses(): (URL)[] { const decoded = await AnnounceAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20375,7 +22468,12 @@ get licenses(): (URL)[] { const decoded = await Translation.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -20429,6 +22527,16 @@ get licenses(): (URL)[] { } instance.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = _2rzkBRS4gNPrkJk9DohHAMUAxA2d; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Object.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -21453,6 +23561,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -21518,9 +23630,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -21708,6 +23821,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -21840,6 +23955,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Emoji)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -21847,6 +23965,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Emoji.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -22019,6 +24147,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -22132,9 +24264,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -22262,6 +24395,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quote", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quote", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#quoteUrl", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ "@value": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#quoteUrl", descriptor); +descriptors.set("https://misskey-hub.net/ns#_misskey_quote", descriptor); +descriptors.set("http://fedibird.com/ns#quoteUri", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quoteAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ChatMessage).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quoteAuthorization", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -22631,18 +24861,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quote", + ["https://w3id.org/fep/044f#quote"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -23075,18 +25309,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quoteAuthorization", + ["https://w3id.org/fep/044f#quoteAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -23262,8 +25500,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -23282,6 +25525,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { "@value": formatIri(v) } ); @@ -23306,8 +25550,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -23392,6 +25641,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://fedibird.com/ns#quoteUri","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_quote","https://schema.org/license","https://w3id.org/fep/044f#quote","https://w3id.org/fep/044f#quoteAuthorization","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#quoteUrl","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -23524,6 +25775,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ChatMessage)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -23555,7 +25809,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -23635,7 +25894,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -23652,6 +25916,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ChatMessage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -24234,6 +26508,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -24707,9 +26985,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -24909,6 +27188,214 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#actor", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#actor", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#object", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#object", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#target", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#target", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#result", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#result", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#origin", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#origin", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#instrument", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Activity).#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#instrument", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchActor( url: URL, @@ -25338,18 +27825,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#actor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "actor", + ["https://www.w3.org/ns/activitystreams#actor"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -25502,18 +27993,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#actor_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "actor", + ["https://www.w3.org/ns/activitystreams#actor"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -25925,18 +28420,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#object_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "object", + ["https://www.w3.org/ns/activitystreams#object"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -26089,18 +28588,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#object_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "object", + ["https://www.w3.org/ns/activitystreams#object"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -26515,18 +29018,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#target_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "target", + ["https://www.w3.org/ns/activitystreams#target"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -26682,18 +29189,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#target_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "target", + ["https://www.w3.org/ns/activitystreams#target"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -27105,18 +29616,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#result_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "result", + ["https://www.w3.org/ns/activitystreams#result"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -27269,18 +29784,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#result_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "result", + ["https://www.w3.org/ns/activitystreams#result"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -27693,18 +30212,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#origin_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "origin", + ["https://www.w3.org/ns/activitystreams#origin"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -27858,18 +30381,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#origin_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "origin", + ["https://www.w3.org/ns/activitystreams#origin"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -28280,18 +30807,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#instrument_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "instrument", + ["https://www.w3.org/ns/activitystreams#instrument"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -28443,18 +30974,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#instrument_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "instrument", + ["https://www.w3.org/ns/activitystreams#instrument"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -28546,8 +31081,29 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28566,8 +31122,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28586,8 +31147,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28606,8 +31172,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28626,8 +31197,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28646,8 +31222,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -28732,6 +31313,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -29004,6 +31587,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Activity)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -29036,23 +31622,48 @@ const base = getDeepCloneDescriptor(this.prototype)!; 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -29093,7 +31704,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29134,7 +31750,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29175,7 +31796,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29216,7 +31842,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29257,7 +31888,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -29274,6 +31910,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Activity.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -29558,6 +32204,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -29629,9 +32279,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -29806,6 +32457,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -29938,6 +32591,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof EmojiReact)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -29945,6 +32601,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + EmojiReact.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -30005,7 +32671,7 @@ instruments?: (Object | URL)[];} }; /** A pair of property name and value. */ -export class PropertyValue { +export class PropertyValue implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -30021,6 +32687,14 @@ export class PropertyValue { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -30166,6 +32840,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -30205,6 +32883,7 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if ("name" in values && values.name != null) { @@ -30250,9 +32929,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -30308,6 +32988,88 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: PropertyValue, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#name", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as PropertyValue).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#name", descriptor); + + descriptor = { + canonicalIri: "http://schema.org#value", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as PropertyValue).#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://schema.org#value", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The name of a property. */ @@ -30424,6 +33186,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -30447,6 +33210,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -30535,6 +33299,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://schema.org#value","https://www.w3.org/ns/activitystreams#name"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -30736,6 +33502,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = _2cSy2magg4iZ7zLaG8U7DiJMoCkx_value; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + PropertyValue.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -30851,7 +33627,7 @@ deepCloneDescriptors.set(this.prototype, { }; /** A quantity with a unit of measure. */ -export class Measure { +export class Measure implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -30867,6 +33643,14 @@ export class Measure { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -31012,6 +33796,10 @@ unit?: string | null;numericalValue?: Decimal | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -31051,6 +33839,7 @@ unit?: string | null;numericalValue?: Decimal | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < vocabSparseArrayMinimumLength ? this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice() : vocabCopyPropertyArray(this.#_27fgyFbosTtMAhuepJH8K3ZGURT6); if ("unit" in values && values.unit != null) { @@ -31096,9 +33885,10 @@ unit?: string | null;numericalValue?: Decimal | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -31154,6 +33944,85 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Measure, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Measure).#_27fgyFbosTtMAhuepJH8K3ZGURT6) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit", descriptor); + + descriptor = { + canonicalIri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Measure).#_1GQx8o2RgxRs4x9G5uT39XYBv7D) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#decimal", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The name of the unit, according to the Ontology of units of Measure * classification. The recommended unit for countable items is \`"one"\`. @@ -31268,6 +34137,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) { + let element = ( { "@value": v } ); @@ -31288,6 +34158,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#decimal", @@ -31366,6 +34237,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue","http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -31560,6 +34433,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = _1GQx8o2RgxRs4x9G5uT39XYBv7D; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Measure.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -31777,6 +34660,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -31876,9 +34763,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -31984,6 +34872,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactingObject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as AnnounceAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactingObject", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactionTarget", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as AnnounceAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactionTarget", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -32352,18 +35308,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactingObject", + ["https://gotosocial.org/ns#interactingObject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -32772,18 +35732,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactionTarget", + ["https://gotosocial.org/ns#interactionTarget"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -32933,8 +35897,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -32953,8 +35922,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -33039,6 +36013,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactingObject","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#interactionTarget","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -33171,6 +36147,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof AnnounceAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -33202,7 +36181,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -33243,7 +36227,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -33260,6 +36249,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + AnnounceAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -33438,6 +36437,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -33509,9 +36512,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -33686,6 +36690,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -33818,6 +36824,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof AnnounceRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -33825,6 +36834,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + AnnounceRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -33892,7 +36911,7 @@ instruments?: (Object | URL)[];} * for details. * */ -export class InteractionPolicy { +export class InteractionPolicy implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -33908,6 +36927,14 @@ export class InteractionPolicy { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -34095,6 +37122,10 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -34134,6 +37165,7 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length < vocabSparseArrayMinimumLength ? this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice() : vocabCopyPropertyArray(this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature); if ("canFeature" in values && values.canFeature != null) { @@ -34221,9 +37253,10 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -34389,6 +37422,183 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: InteractionPolicy, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#canFeature", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#canFeature", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#canLike", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#canLike", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#canReply", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#canReply", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#canAnnounce", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#canAnnounce", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#canQuote", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionPolicy).#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#canQuote", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The sub-policy specifying who can feature the actor in a * {@link FeaturedCollection}. @@ -34513,8 +37723,13 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34533,8 +37748,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34553,8 +37773,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34573,8 +37798,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34593,8 +37823,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -34693,6 +37928,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://gotosocial.org/ns#canAnnounce","https://gotosocial.org/ns#canLike","https://gotosocial.org/ns#canQuote","https://gotosocial.org/ns#canReply","https://w3id.org/fep/7aa9#canFeature"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -34843,7 +38080,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34875,7 +38117,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34907,7 +38154,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34939,7 +38191,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34971,7 +38228,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await InteractionRule.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -34988,6 +38250,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = _LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + InteractionPolicy.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -35181,7 +38453,7 @@ deepCloneDescriptors.set(this.prototype, { * for details. * */ -export class InteractionRule { +export class InteractionRule implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -35197,6 +38469,14 @@ export class InteractionRule { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -35438,6 +38718,10 @@ manualApprovals?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -35479,6 +38763,7 @@ manualApprovals?: (URL)[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < vocabSparseArrayMinimumLength ? this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice() : vocabCopyPropertyArray(this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval); if ("automaticApproval" in values && values.automaticApproval != null) { @@ -35618,9 +38903,10 @@ manualApprovals?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -35722,6 +39008,82 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: InteractionRule, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#automaticApproval", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionRule).#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#automaticApproval", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#manualApproval", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as InteractionRule).#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#manualApproval", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** URIs of actors or collections whose interactions are automatically * approved without requiring manual review by the post author. @@ -35809,6 +39171,7 @@ get manualApprovals(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval) { + let element = ( { "@id": formatIri(v) } ); @@ -35829,6 +39192,7 @@ get manualApprovals(): (URL)[] { array = []; for (const v of this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval) { + let element = ( { "@id": formatIri(v) } ); @@ -35904,6 +39268,8 @@ get manualApprovals(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://gotosocial.org/ns#automaticApproval","https://gotosocial.org/ns#manualApproval"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -36097,6 +39463,16 @@ get manualApprovals(): (URL)[] { } instance.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = _sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + InteractionRule.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -36325,6 +39701,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -36424,9 +39804,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -36532,6 +39913,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactingObject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as LikeAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactingObject", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactionTarget", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as LikeAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactionTarget", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -36900,18 +40349,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactingObject", + ["https://gotosocial.org/ns#interactingObject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -37320,18 +40773,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactionTarget", + ["https://gotosocial.org/ns#interactionTarget"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -37481,8 +40938,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -37501,8 +40963,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -37587,6 +41054,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactingObject","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#interactionTarget","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -37719,6 +41188,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof LikeAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -37750,7 +41222,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -37791,7 +41268,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -37808,6 +41290,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + LikeAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -37985,6 +41477,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -38056,9 +41552,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -38233,6 +41730,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -38365,6 +41864,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof LikeRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -38372,6 +41874,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + LikeRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -38533,6 +42045,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -38632,9 +42148,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -38740,6 +42257,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactingObject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ReplyAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactingObject", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactionTarget", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ReplyAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactionTarget", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -39108,18 +42693,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactingObject", + ["https://gotosocial.org/ns#interactingObject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -39528,18 +43117,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactionTarget", + ["https://gotosocial.org/ns#interactionTarget"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -39689,8 +43282,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -39709,8 +43307,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -39795,6 +43398,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactingObject","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#interactionTarget","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -39927,6 +43532,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ReplyAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -39958,7 +43566,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -39999,7 +43612,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -40016,6 +43634,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ReplyAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -40193,6 +43821,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -40264,9 +43896,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -40441,6 +44074,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -40573,6 +44208,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ReplyRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -40580,6 +44218,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ReplyRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -40741,6 +44389,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -40840,9 +44492,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -40948,6 +44601,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactingObject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as QuoteAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactingObject", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactionTarget", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as QuoteAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactionTarget", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -41315,18 +45036,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactingObject", + ["https://gotosocial.org/ns#interactingObject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -41735,18 +45460,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactionTarget", + ["https://gotosocial.org/ns#interactionTarget"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -41896,8 +45625,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -41916,8 +45650,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -42002,6 +45741,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactingObject","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#interactionTarget","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -42134,6 +45875,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof QuoteAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -42165,7 +45909,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -42206,7 +45955,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -42223,6 +45977,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + QuoteAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -42400,6 +46164,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -42471,9 +46239,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -42648,6 +46417,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -42780,6 +46551,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof QuoteRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -42787,6 +46561,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + QuoteRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -42854,7 +46638,7 @@ instruments?: (Object | URL)[];} * Targets [draft revision 6d0d6559](https://codeberg.org/fediverse/fep/src/commit/6d0d6559054baeb7b71a5f2bdc14fc4c09b66f39/fep/22cd/fep-22cd.md). * */ -export class Translation { +export class Translation implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -42870,6 +46654,14 @@ export class Translation { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -43171,6 +46963,10 @@ urls?: ((URL | Link))[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -43212,6 +47008,7 @@ urls?: ((URL | Link))[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < vocabSparseArrayMinimumLength ? this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice() : vocabCopyPropertyArray(this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG); if ("language" in values && values.language != null) { @@ -43413,9 +47210,10 @@ urls?: ((URL | Link))[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -43561,6 +47359,217 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Translation, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://schema.org/inLanguage", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) { + + let element = ( +{ "@value": v.baseName } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://schema.org/inLanguage", descriptor); + + descriptor = { + canonicalIri: "https://schema.org/translator", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://schema.org/translator", descriptor); + + descriptor = { + canonicalIri: "https://schema.org/translationOfWork", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://schema.org/translationOfWork", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/22cd#sourceUpdated", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/22cd#sourceUpdated", descriptor); + + descriptor = { + canonicalIri: "https://schema.org/isBasedOn", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://schema.org/isBasedOn", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#url", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Translation).#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + + let element = ( +v instanceof URL ?{ "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#url", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The translated language. Publishers must match a language in the * containing object's content, name, or summary map. @@ -44008,18 +48017,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#translator_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "translator", + ["https://schema.org/translator"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -44175,18 +48188,22 @@ deepCloneDescriptors.set(this.prototype, { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#translator_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "translator", + ["https://schema.org/translator"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -44469,6 +48486,7 @@ get urls(): ((URL | Link))[] { const values: Record = {}; array = []; for (const v of this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG) { + let element = ( { "@value": v.baseName } ); @@ -44489,8 +48507,29 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -44509,6 +48548,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7) { + let element = ( { "@id": formatIri(v) } ); @@ -44529,6 +48569,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -44552,6 +48593,7 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW) { + let element = ( { "@id": formatIri(v) } ); @@ -44572,8 +48614,13 @@ get urls(): ((URL | Link))[] { array = []; for (const v of this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url) { + let element = ( - v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options) + v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -44652,6 +48699,8 @@ get urls(): ((URL | Link))[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://schema.org/inLanguage","https://schema.org/isBasedOn","https://schema.org/translationOfWork","https://schema.org/translator","https://w3id.org/fep/22cd#sourceUpdated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -44841,23 +48890,48 @@ 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -44984,7 +49058,12 @@ 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -45001,6 +49080,16 @@ get urls(): ((URL | Link))[] { } instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Translation.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -45305,6 +49394,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -45404,9 +49497,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -45512,6 +49606,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactingObject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeatureAuthorization).#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactingObject", descriptor); + + descriptor = { + canonicalIri: "https://gotosocial.org/ns#interactionTarget", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeatureAuthorization).#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://gotosocial.org/ns#interactionTarget", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchInteractingObject( url: URL, @@ -45878,18 +50040,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactingObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactingObject", + ["https://gotosocial.org/ns#interactingObject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -46297,18 +50463,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#interactionTarget_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "interactionTarget", + ["https://gotosocial.org/ns#interactionTarget"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -46458,8 +50628,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -46478,8 +50653,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -46564,6 +50744,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactingObject","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#interactionTarget","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -46696,6 +50878,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeatureAuthorization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -46727,7 +50912,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -46768,7 +50958,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -46785,6 +50980,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeatureAuthorization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -46959,6 +51164,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -47030,9 +51239,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -47207,6 +51417,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -47339,6 +51551,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeatureRequest)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -47346,6 +51561,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeatureRequest.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -47706,6 +51931,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -48017,9 +52246,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -48345,6 +52575,418 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#totalItems", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#totalItems", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#current", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3UyUdxnyn6cDn53QKrh4MBiearma_current) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#current", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#first", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_J52RqweMe6hhv7RnLJMC8BExTE5_first) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#first", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#last", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#last", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#items", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#items", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#likesOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#likesOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#sharesOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#sharesOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#repliesOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#repliesOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#inboxOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#inboxOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#outboxOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#outboxOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#followersOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#followersOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#followingOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#followingOf", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/5711#likedOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Collection).#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/5711#likedOf", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A non-negative integer specifying the total number of objects contained by * the logical view of the collection. This number might not reflect the actual @@ -48729,18 +53371,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#current_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "current", + ["https://www.w3.org/ns/activitystreams#current"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -49150,18 +53796,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#first_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "first", + ["https://www.w3.org/ns/activitystreams#first"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -49571,18 +54221,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#last_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "last", + ["https://www.w3.org/ns/activitystreams#last"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -50011,18 +54665,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "items", + ["https://www.w3.org/ns/activitystreams#items"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -50432,18 +55090,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#likesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "likesOf", + ["https://w3id.org/fep/5711#likesOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -50852,18 +55514,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#sharesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "sharesOf", + ["https://w3id.org/fep/5711#sharesOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -51272,18 +55938,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#repliesOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "repliesOf", + ["https://w3id.org/fep/5711#repliesOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -51692,18 +56362,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#inboxOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inboxOf", + ["https://w3id.org/fep/5711#inboxOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -52112,18 +56786,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#outboxOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "outboxOf", + ["https://w3id.org/fep/5711#outboxOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -52532,18 +57210,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followersOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followersOf", + ["https://w3id.org/fep/5711#followersOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -52952,18 +57634,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followingOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followingOf", + ["https://w3id.org/fep/5711#followingOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -53372,18 +58058,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#likedOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "likedOf", + ["https://w3id.org/fep/5711#likedOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -53753,6 +58443,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -53776,8 +58467,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53796,8 +58492,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53816,8 +58517,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53836,8 +58542,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53856,8 +58571,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53876,8 +58596,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53896,8 +58621,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53916,8 +58646,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53936,8 +58671,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53956,8 +58696,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53976,8 +58721,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -53996,8 +58746,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -54082,6 +58837,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/5711#followersOf","https://w3id.org/fep/5711#followingOf","https://w3id.org/fep/5711#inboxOf","https://w3id.org/fep/5711#likedOf","https://w3id.org/fep/5711#likesOf","https://w3id.org/fep/5711#outboxOf","https://w3id.org/fep/5711#repliesOf","https://w3id.org/fep/5711#sharesOf","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#current","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#first","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#items","https://www.w3.org/ns/activitystreams#last","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#totalItems","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -54230,6 +58987,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Collection)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -54290,7 +59050,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54331,7 +59096,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54372,7 +59142,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54415,12 +59190,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -54461,7 +59246,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54502,7 +59292,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54543,7 +59338,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54584,7 +59384,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54625,7 +59430,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54666,7 +59476,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54707,7 +59522,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54748,7 +59568,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -54765,6 +59590,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Collection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -55194,6 +60029,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -55304,9 +60143,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -55390,6 +60230,47 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#items", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollection).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#items", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchItem( url: URL, @@ -55777,18 +60658,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "orderedItems", + ["https://www.w3.org/ns/activitystreams#items"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -55920,8 +60805,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -56006,6 +60900,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/5711#followersOf","https://w3id.org/fep/5711#followingOf","https://w3id.org/fep/5711#inboxOf","https://w3id.org/fep/5711#likedOf","https://w3id.org/fep/5711#likesOf","https://w3id.org/fep/5711#outboxOf","https://w3id.org/fep/5711#repliesOf","https://w3id.org/fep/5711#sharesOf","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#current","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#first","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#items","https://www.w3.org/ns/activitystreams#last","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#totalItems","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -56142,6 +61038,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof OrderedCollection)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -56175,12 +61074,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -56197,6 +61106,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + OrderedCollection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -56371,6 +61290,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -56464,9 +61387,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -56550,6 +61474,70 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#topic", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedCollection).#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#topic", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#discoverable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedCollection).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#discoverable", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A single {@link Hashtag} object that represents the main topic or category * of this featured collection. @@ -56685,8 +61673,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -56705,6 +61698,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { "@value": v } ); @@ -56791,6 +61785,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://joinmastodon.org/ns#discoverable","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/5711#followersOf","https://w3id.org/fep/5711#followingOf","https://w3id.org/fep/5711#inboxOf","https://w3id.org/fep/5711#likedOf","https://w3id.org/fep/5711#likesOf","https://w3id.org/fep/5711#outboxOf","https://w3id.org/fep/5711#repliesOf","https://w3id.org/fep/5711#sharesOf","https://w3id.org/fep/7aa9#topic","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#current","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#first","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#items","https://www.w3.org/ns/activitystreams#last","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#totalItems","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -56923,6 +61919,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeaturedCollection)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -56945,7 +61944,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Hashtag.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -56991,6 +61995,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = _gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeaturedCollection.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -57187,6 +62201,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -57286,9 +62304,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -57394,6 +62413,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featuredObject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedItem).#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featuredObject", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featureAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as FeaturedItem).#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featureAuthorization", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchFeaturedObject( url: URL, @@ -57760,18 +62847,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredObject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredObject", + ["https://w3id.org/fep/7aa9#featuredObject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -58181,18 +63272,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featureAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featureAuthorization", + ["https://w3id.org/fep/7aa9#featureAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -58342,8 +63437,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -58362,8 +63462,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -58448,6 +63553,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/7aa9#featureAuthorization","https://w3id.org/fep/7aa9#featuredObject","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -58580,6 +63687,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof FeaturedItem)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -58611,7 +63721,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -58652,7 +63767,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await FeatureAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -58669,6 +63789,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + FeaturedItem.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -58773,7 +63903,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; * and verifiable credential repository services. * */ -export class DidService { +export class DidService implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -58789,6 +63919,14 @@ export class DidService { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -58968,6 +64106,10 @@ endpoints?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -59008,6 +64150,7 @@ endpoints?: (URL)[];} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < vocabSparseArrayMinimumLength ? this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice() : vocabCopyPropertyArray(this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint); if ("endpoint" in values && values.endpoint != null) { @@ -59086,9 +64229,10 @@ endpoints?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -59167,6 +64311,55 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: DidService, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/did#serviceEndpoint", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DidService).#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/did#serviceEndpoint", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A network address, such as an HTTP URL, at which services operate on behalf * of a DID subject. @@ -59229,6 +64422,7 @@ get endpoints(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint) { + let element = ( { "@id": formatIri(v) } ); @@ -59304,6 +64498,8 @@ get endpoints(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://www.w3.org/ns/did#serviceEndpoint"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -59472,6 +64668,16 @@ get endpoints(): (URL)[] { } instance.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = _2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + DidService.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -59620,6 +64826,10 @@ endpoints?: (URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -59670,9 +64880,10 @@ endpoints?: (URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -59815,6 +65026,8 @@ endpoints?: (URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://www.w3.org/ns/did#serviceEndpoint"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -59947,6 +65160,9 @@ endpoints?: (URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Export)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -59954,6 +65170,16 @@ endpoints?: (URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Export.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -60016,7 +65242,7 @@ endpoints?: (URL)[];} * verify the identity of the actor and the integrity of the data. * */ -export class DataIntegrityProof { +export class DataIntegrityProof implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -60032,6 +65258,14 @@ export class DataIntegrityProof { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -60223,6 +65457,10 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -60262,6 +65500,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < vocabSparseArrayMinimumLength ? this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice() : vocabCopyPropertyArray(this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite); if ("cryptosuite" in values && values.cryptosuite != null) { @@ -60354,9 +65593,10 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -60456,6 +65696,175 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: DataIntegrityProof, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/security#cryptosuite", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#cryptosuite", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#verificationMethod", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#verificationMethod", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#proofPurpose", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { + + let element = ( +{ + "@id": "https://w3id.org/security#" + v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#proofPurpose", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#proofValue", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { + + let element = ( +{ + "@type": "https://w3id.org/security#multibase", + "@value": new TextDecoder().decode(encodeMultibase("base58btc", v)), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#proofValue", descriptor); + + descriptor = { + canonicalIri: "http://purl.org/dc/terms/created", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as DataIntegrityProof).#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://purl.org/dc/terms/created", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The cryptographic suite used to create the proof. * @@ -60944,6 +66353,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite) { + let element = ( { "@value": v } ); @@ -60964,8 +66374,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -60984,6 +66399,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose) { + let element = ( { "@id": "https://w3id.org/security#" + v, @@ -61006,6 +66422,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue) { + let element = ( { "@type": "https://w3id.org/security#multibase", @@ -61029,6 +66446,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -61107,6 +66525,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://purl.org/dc/terms/created","https://w3id.org/security#cryptosuite","https://w3id.org/security#proofPurpose","https://w3id.org/security#proofValue","https://w3id.org/security#verificationMethod"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -61295,7 +66715,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -61403,6 +66828,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = _3qzP3ukEZoUziK5FEiA1RhU4aqac; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + DataIntegrityProof.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -61578,7 +67013,7 @@ deepCloneDescriptors.set(this.prototype, { }; /** A key owned by an actor. */ -export class CryptographicKey { +export class CryptographicKey implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -61594,6 +67029,14 @@ export class CryptographicKey { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -61744,6 +67187,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -61783,6 +67230,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < vocabSparseArrayMinimumLength ? this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice() : vocabCopyPropertyArray(this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner);clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = vocabCopyTrustSet( this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, @@ -61834,9 +67282,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -61914,6 +67363,102 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: CryptographicKey, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/security#owner", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CryptographicKey).#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#owner", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKeyPem", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CryptographicKey).#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { + + let element = ( +{ "@value": await exportSpki(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKeyPem", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchOwner( url: URL, @@ -62340,18 +67885,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#owner_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "owner", + ["https://w3id.org/security#owner"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -62510,8 +68059,29 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -62530,6 +68100,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem) { + let element = ( { "@value": await exportSpki(v) } ); @@ -62605,6 +68176,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://w3id.org/security#owner","https://w3id.org/security#publicKeyPem"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -62765,23 +68338,48 @@ deepCloneDescriptors.set(this.prototype, { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -62827,6 +68425,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + CryptographicKey.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -62946,7 +68554,7 @@ deepCloneDescriptors.set(this.prototype, { * [1]: https://w3id.org/fep/521a * */ -export class Multikey { +export class Multikey implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -62962,6 +68570,14 @@ export class Multikey { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -63112,6 +68728,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -63151,6 +68771,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < vocabSparseArrayMinimumLength ? this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice() : vocabCopyPropertyArray(this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller);clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = vocabCopyTrustSet( this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, @@ -63202,9 +68823,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -63282,6 +68904,105 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Multikey, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/security#controller", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Multikey).#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#controller", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKeyMultibase", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Multikey).#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { + + let element = ( +{ + "@type": "https://w3id.org/security#multibase", + "@value": await exportMultibaseKey(v), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKeyMultibase", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchController( url: URL, @@ -63708,18 +69429,22 @@ deepCloneDescriptors.set(this.prototype, { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#controller_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "controller", + ["https://w3id.org/security#controller"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -63882,8 +69607,29 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -63902,6 +69648,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase) { + let element = ( { "@type": "https://w3id.org/security#multibase", @@ -63980,6 +69727,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://w3id.org/security#controller","https://w3id.org/security#publicKeyMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -64140,23 +69889,48 @@ deepCloneDescriptors.set(this.prototype, { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -64202,6 +69976,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = _4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Multikey.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -64418,6 +70202,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -64511,9 +70299,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -64619,6 +70408,74 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#stipulates", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Agreement).#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#stipulates", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#stipulatesReciprocal", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Agreement).#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#stipulatesReciprocal", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The primary {@link Commitment} associated with the agreement. This * commitment satisfies the primary {@link Intent} of the corresponding @@ -64759,8 +70616,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -64779,8 +70641,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -64865,6 +70732,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://w3id.org/valueflows/ont/vf#stipulates","https://w3id.org/valueflows/ont/vf#stipulatesReciprocal","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -64997,6 +70866,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Agreement)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -65019,7 +70891,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Commitment.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65051,7 +70928,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Commitment.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65068,6 +70950,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = _4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Agreement.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -65172,7 +71064,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; * specifies the actual amount of the economic resource being committed. * */ -export class Commitment { +export class Commitment implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -65188,6 +71080,14 @@ export class Commitment { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -65333,6 +71233,10 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -65372,6 +71276,7 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length < vocabSparseArrayMinimumLength ? this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice() : vocabCopyPropertyArray(this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies); if ("satisfies" in values && values.satisfies != null) { @@ -65417,9 +71322,10 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -65519,6 +71425,86 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Commitment, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#satisfies", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Commitment).#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#satisfies", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#resourceQuantity", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Commitment).#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#resourceQuantity", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The {@link Intent} of a {@link Proposal} that this commitment * satisfies. The value is the proposal's URI with a @@ -65641,6 +71627,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies) { + let element = ( { "@id": formatIri(v) } ); @@ -65661,8 +71648,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -65736,6 +71728,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://w3id.org/valueflows/ont/vf#resourceQuantity","https://w3id.org/valueflows/ont/vf#satisfies"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -65915,7 +71909,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -65932,6 +71931,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Commitment.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -66049,7 +72058,7 @@ deepCloneDescriptors.set(this.prototype, { * in a {@link Proposal}. * */ -export class Intent { +export class Intent implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -66065,6 +72074,14 @@ export class Intent { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -66252,6 +72269,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -66291,6 +72312,7 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < vocabSparseArrayMinimumLength ? this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice() : vocabCopyPropertyArray(this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action); if ("action" in values && values.action != null) { @@ -66378,9 +72400,10 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -66524,6 +72547,175 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Intent, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#action", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#action", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#resourceConformsTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#resourceConformsTo", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#resourceQuantity", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#resourceQuantity", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#availableQuantity", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#availableQuantity", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#minimumQuantity", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Intent).#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#minimumQuantity", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The type of economic transaction. The value of this property should be * either \`"deliverService"\` or \`"transfer"\`. @@ -66739,6 +72931,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) { + let element = ( { "@value": v } ); @@ -66759,6 +72952,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) { + let element = ( { "@id": formatIri(v) } ); @@ -66779,8 +72973,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66799,8 +72998,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66819,8 +73023,13 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -66894,6 +73103,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://w3id.org/valueflows/ont/vf#action","https://w3id.org/valueflows/ont/vf#availableQuantity","https://w3id.org/valueflows/ont/vf#minimumQuantity","https://w3id.org/valueflows/ont/vf#resourceConformsTo","https://w3id.org/valueflows/ont/vf#resourceQuantity"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -67103,7 +73314,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67135,7 +73351,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67167,7 +73388,12 @@ deepCloneDescriptors.set(this.prototype, { const decoded = await Measure.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -67184,6 +73410,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Intent.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -67488,6 +73724,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -67609,9 +73849,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -67717,6 +73958,128 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#purpose", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#purpose", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#publishes", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#publishes", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#reciprocal", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#reciprocal", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/valueflows/ont/vf#unitBased", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Proposal).#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/valueflows/ont/vf#unitBased", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The type of proposal. Possible values are \`"offer"\` and \`"request"\`. * @@ -67916,6 +74279,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) { + let element = ( { "@value": v } ); @@ -67936,8 +74300,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -67956,8 +74325,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -67976,6 +74350,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) { + let element = ( { "@value": v } ); @@ -68062,6 +74437,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://w3id.org/valueflows/ont/vf#publishes","https://w3id.org/valueflows/ont/vf#purpose","https://w3id.org/valueflows/ont/vf#reciprocal","https://w3id.org/valueflows/ont/vf#unitBased","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -68194,6 +74571,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Proposal)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -68246,7 +74626,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -68278,7 +74663,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Intent.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -68324,6 +74714,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Proposal.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -68534,6 +74934,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -68605,9 +75009,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -68782,6 +75187,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -68918,6 +75325,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Accept)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -68925,6 +75335,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Accept.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -69056,6 +75476,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -69127,9 +75551,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -69304,6 +75729,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -69436,6 +75863,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Add)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -69443,6 +75873,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Add.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -69573,6 +76013,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -69644,9 +76088,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -69821,6 +76266,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -69953,6 +76400,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Announce)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -69960,6 +76410,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Announce.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -70823,6 +77283,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -71648,9 +78112,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -72092,6 +78557,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preferredUsername", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preferredUsername", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKey", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#assertionMethod", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#assertionMethod", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/ef61/gateways", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ "@id": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://w3id.org/fep/ef61/gateways", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", descriptor); + + descriptor = { + canonicalIri: "http://www.w3.org/ns/ldp#inbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.w3.org/ns/ldp#inbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#outbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#outbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#following", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#following", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#followers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#followers", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#liked", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#liked", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featured", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featured", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featuredTags", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featuredTags", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featuredCollections", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featuredCollections", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#streams", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#streams", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#endpoints", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#endpoints", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#discoverable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#discoverable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#suspended", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#suspended", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#memorial", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#memorial", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#indexable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#indexable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#attributionDomains", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#attributionDomains", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#movedTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#movedTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#alsoKnownAs", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#alsoKnownAs", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/did#service", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/did#service", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#_misskey_followedMessage", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#_misskey_followedMessage", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#isCat", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#isCat", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/6757#preferredLicense", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Application).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/6757#preferredLicense", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -72481,18 +79757,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -72642,18 +79922,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -73066,18 +80350,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -73231,18 +80519,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -73725,18 +81017,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inbox", + ["http://www.w3.org/ns/ldp#inbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -74169,18 +81465,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "outbox", + ["https://www.w3.org/ns/activitystreams#outbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -74593,18 +81893,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "following", + ["https://www.w3.org/ns/activitystreams#following"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -75020,18 +82324,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followers", + ["https://www.w3.org/ns/activitystreams#followers"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -75445,18 +82753,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "liked", + ["https://www.w3.org/ns/activitystreams#liked"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -75868,18 +83180,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featured", + ["http://joinmastodon.org/ns#featured"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -76291,18 +83607,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredTags", + ["http://joinmastodon.org/ns#featuredTags"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -76711,18 +84031,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredCollections", + ["https://w3id.org/fep/7aa9#featuredCollections"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -77135,18 +84459,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "streams", + ["https://www.w3.org/ns/activitystreams#streams"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -77701,18 +85029,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "movedTo", + ["https://www.w3.org/ns/activitystreams#movedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -78184,18 +85516,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -78349,18 +85685,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -78773,18 +86113,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -78938,18 +86282,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -79626,6 +86974,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -79649,8 +86998,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79669,8 +87023,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79689,6 +87048,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { "@id": v.origin } ); @@ -79709,6 +87069,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { "@value": v } ); @@ -79729,8 +87090,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79749,8 +87119,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79769,8 +87148,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79789,8 +87173,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79809,8 +87198,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79829,8 +87223,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79849,8 +87248,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79869,8 +87273,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79889,8 +87298,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79909,8 +87323,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -79929,6 +87348,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { "@value": v } ); @@ -79949,6 +87369,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { "@value": v } ); @@ -79969,6 +87390,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { "@value": v } ); @@ -79989,6 +87411,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { "@value": v } ); @@ -80009,6 +87432,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { "@value": v } ); @@ -80029,8 +87453,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80049,8 +87494,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80069,8 +87535,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -80089,6 +87560,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { "@value": v } ); @@ -80109,6 +87581,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { "@value": v } ); @@ -80129,6 +87602,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { "@id": formatIri(v) } ); @@ -80230,6 +87704,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://joinmastodon.org/ns#attributionDomains","http://joinmastodon.org/ns#discoverable","http://joinmastodon.org/ns#featured","http://joinmastodon.org/ns#featuredTags","http://joinmastodon.org/ns#indexable","http://joinmastodon.org/ns#memorial","http://joinmastodon.org/ns#suspended","http://purl.org/dc/terms/license","http://www.w3.org/ns/ldp#inbox","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_followedMessage","https://misskey-hub.net/ns#isCat","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/6757#preferredLicense","https://w3id.org/fep/7aa9#featuredCollections","https://w3id.org/fep/ef61/gateways","https://w3id.org/security#assertionMethod","https://w3id.org/security#proof","https://w3id.org/security#publicKey","https://www.w3.org/ns/activitystreams#alsoKnownAs","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#endpoints","https://www.w3.org/ns/activitystreams#followers","https://www.w3.org/ns/activitystreams#following","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#liked","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#movedTo","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#outbox","https://www.w3.org/ns/activitystreams#preferredUsername","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#streams","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/did#service"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -80362,6 +87838,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Application)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -80426,7 +87905,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80467,7 +87951,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80568,11 +88057,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -80615,11 +88114,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -80660,7 +88169,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80701,7 +88215,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80742,7 +88261,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80783,7 +88307,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80824,7 +88353,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80865,7 +88399,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80906,7 +88445,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -80938,7 +88482,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -81126,23 +88675,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -81184,23 +88758,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -81241,7 +88840,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -81346,6 +88950,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Application.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -82036,6 +89650,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -82107,9 +89725,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -82284,6 +89903,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -82428,6 +90049,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof IntransitiveActivity)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -82435,6 +90059,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + IntransitiveActivity.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -82565,6 +90199,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -82636,9 +90274,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -82813,6 +90452,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -82945,6 +90586,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Arrive)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -82952,6 +90596,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Arrive.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -83119,6 +90773,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -83232,9 +90890,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -83362,6 +91021,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quote", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quote", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#quoteUrl", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ "@value": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#quoteUrl", descriptor); +descriptors.set("https://misskey-hub.net/ns#_misskey_quote", descriptor); +descriptors.set("http://fedibird.com/ns#quoteUri", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quoteAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Article).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quoteAuthorization", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -83731,18 +91487,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quote", + ["https://w3id.org/fep/044f#quote"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -84175,18 +91935,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quoteAuthorization", + ["https://w3id.org/fep/044f#quoteAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -84362,8 +92126,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -84382,6 +92151,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { "@value": formatIri(v) } ); @@ -84406,8 +92176,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -84492,6 +92267,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://fedibird.com/ns#quoteUri","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_quote","https://schema.org/license","https://w3id.org/fep/044f#quote","https://w3id.org/fep/044f#quoteAuthorization","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#quoteUrl","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -84624,6 +92401,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Article)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -84655,7 +92435,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -84735,7 +92520,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -84752,6 +92542,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Article.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -84975,6 +92775,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -85082,9 +92886,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -85138,6 +92943,99 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu }; return deepCloneGraph(this, this.clone(values, cloneOptions)); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#width", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#width", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#height", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#height", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/credentials/v2#digestMultibase", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Document).#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/credentials/v2#digestMultibase", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Specifies a hint as to the rendering width in * device-independent pixels of the linked resource. @@ -85301,6 +93199,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -85324,6 +93223,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -85347,6 +93247,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu array = []; for (const v of this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + let element = ( { "@value": v } ); @@ -85433,6 +93334,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -85581,6 +93484,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Document)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -85676,6 +93582,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } instance.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = _2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Document.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -85857,6 +93773,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -85922,9 +93842,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -86112,6 +94033,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -86244,6 +94167,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Audio)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -86251,6 +94177,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Audio.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -86380,6 +94316,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -86451,9 +94391,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -86628,6 +94569,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -86764,6 +94707,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Ignore)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -86771,6 +94717,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Ignore.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -86902,6 +94858,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -86973,9 +94933,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -87150,6 +95111,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -87282,6 +95245,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Block)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -87289,6 +95255,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Block.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -87461,6 +95437,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -87577,9 +95557,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -87707,6 +95688,105 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#partOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#partOf", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#next", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#next", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#prev", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as CollectionPage).#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#prev", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchPartOf( url: URL, @@ -88075,18 +96155,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#partOf_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "partOf", + ["https://www.w3.org/ns/activitystreams#partOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -88494,18 +96578,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#next_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "next", + ["https://www.w3.org/ns/activitystreams#next"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -88914,18 +97002,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#prev_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "prev", + ["https://www.w3.org/ns/activitystreams#prev"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -89095,8 +97187,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89115,8 +97212,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89135,8 +97237,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -89221,6 +97328,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/5711#followersOf","https://w3id.org/fep/5711#followingOf","https://w3id.org/fep/5711#inboxOf","https://w3id.org/fep/5711#likedOf","https://w3id.org/fep/5711#likesOf","https://w3id.org/fep/5711#outboxOf","https://w3id.org/fep/5711#repliesOf","https://w3id.org/fep/5711#sharesOf","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#current","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#first","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#items","https://www.w3.org/ns/activitystreams#last","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#next","https://www.w3.org/ns/activitystreams#partOf","https://www.w3.org/ns/activitystreams#prev","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#totalItems","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -89357,6 +97466,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof CollectionPage)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -89388,7 +97500,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89429,7 +97546,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89470,7 +97592,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await CollectionPage.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -89487,6 +97614,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + CollectionPage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -89674,6 +97811,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -89745,9 +97886,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -89922,6 +98064,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -90054,6 +98198,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Create)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -90061,6 +98208,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Create.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -90190,6 +98347,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -90261,9 +98422,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -90438,6 +98600,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -90570,6 +98734,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Delete)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -90577,6 +98744,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Delete.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -90704,6 +98881,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -90775,9 +98956,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -90952,6 +99134,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -91084,6 +99268,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Dislike)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -91091,6 +99278,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Dislike.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -91151,7 +99348,7 @@ instruments?: (Object | URL)[];} }; /** Contents of {@link Actor}'s \`endpoints\`. */ -export class Endpoints { +export class Endpoints implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -91167,6 +99364,14 @@ export class Endpoints { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -91382,6 +99587,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -91421,6 +99630,7 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length < vocabSparseArrayMinimumLength ? this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice() : vocabCopyPropertyArray(this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl); if ("proxyUrl" in values && values.proxyUrl != null) { @@ -91536,9 +99746,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -91748,6 +99959,217 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Endpoints, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#proxyUrl", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#proxyUrl", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#oauthTokenEndpoint", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#oauthTokenEndpoint", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#provideClientKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#provideClientKey", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#signClientKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#signClientKey", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#sharedInbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#sharedInbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#uploadMedia", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Endpoints).#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#uploadMedia", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Endpoint URI so this actor's clients may access remote ActivityStreams * objects which require authentication to access. To use this endpoint, @@ -92038,6 +100460,7 @@ deepCloneDescriptors.set(this.prototype, { const values: Record = {}; array = []; for (const v of this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl) { + let element = ( { "@id": formatIri(v) } ); @@ -92058,6 +100481,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint) { + let element = ( { "@id": formatIri(v) } ); @@ -92078,6 +100502,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint) { + let element = ( { "@id": formatIri(v) } ); @@ -92098,6 +100523,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey) { + let element = ( { "@id": formatIri(v) } ); @@ -92118,6 +100544,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey) { + let element = ( { "@id": formatIri(v) } ); @@ -92138,6 +100565,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox) { + let element = ( { "@id": formatIri(v) } ); @@ -92158,6 +100586,7 @@ deepCloneDescriptors.set(this.prototype, { array = []; for (const v of this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia) { + let element = ( { "@id": formatIri(v) } ); @@ -92233,6 +100662,8 @@ deepCloneDescriptors.set(this.prototype, { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://www.w3.org/ns/activitystreams#oauthAuthorizationEndpoint","https://www.w3.org/ns/activitystreams#oauthTokenEndpoint","https://www.w3.org/ns/activitystreams#provideClientKey","https://www.w3.org/ns/activitystreams#proxyUrl","https://www.w3.org/ns/activitystreams#sharedInbox","https://www.w3.org/ns/activitystreams#signClientKey","https://www.w3.org/ns/activitystreams#uploadMedia"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -92571,6 +101002,16 @@ deepCloneDescriptors.set(this.prototype, { } instance.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = _KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Endpoints.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -92847,6 +101288,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -92912,9 +101357,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -93102,6 +101548,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -93234,6 +101682,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Event)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -93241,6 +101692,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Event.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -93371,6 +101832,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -93442,9 +101907,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -93619,6 +102085,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -93751,6 +102219,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Flag)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -93758,6 +102229,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Flag.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -93889,6 +102370,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -93960,9 +102445,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -94137,6 +102623,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -94269,6 +102757,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Follow)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -94276,6 +102767,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Follow.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -95139,6 +103640,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -95964,9 +104469,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -96408,6 +104914,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preferredUsername", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preferredUsername", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKey", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#assertionMethod", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#assertionMethod", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/ef61/gateways", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ "@id": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://w3id.org/fep/ef61/gateways", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", descriptor); + + descriptor = { + canonicalIri: "http://www.w3.org/ns/ldp#inbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.w3.org/ns/ldp#inbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#outbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#outbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#following", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#following", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#followers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#followers", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#liked", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#liked", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featured", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featured", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featuredTags", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featuredTags", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featuredCollections", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featuredCollections", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#streams", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#streams", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#endpoints", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#endpoints", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#discoverable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#discoverable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#suspended", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#suspended", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#memorial", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#memorial", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#indexable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#indexable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#attributionDomains", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#attributionDomains", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#movedTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#movedTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#alsoKnownAs", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#alsoKnownAs", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/did#service", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/did#service", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#_misskey_followedMessage", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#_misskey_followedMessage", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#isCat", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#isCat", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/6757#preferredLicense", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Group).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/6757#preferredLicense", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -96797,18 +106114,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -96958,18 +106279,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -97382,18 +106707,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -97547,18 +106876,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -98041,18 +107374,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inbox", + ["http://www.w3.org/ns/ldp#inbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -98485,18 +107822,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "outbox", + ["https://www.w3.org/ns/activitystreams#outbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -98909,18 +108250,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "following", + ["https://www.w3.org/ns/activitystreams#following"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -99336,18 +108681,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followers", + ["https://www.w3.org/ns/activitystreams#followers"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -99761,18 +109110,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "liked", + ["https://www.w3.org/ns/activitystreams#liked"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -100184,18 +109537,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featured", + ["http://joinmastodon.org/ns#featured"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -100607,18 +109964,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredTags", + ["http://joinmastodon.org/ns#featuredTags"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -101027,18 +110388,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredCollections", + ["https://w3id.org/fep/7aa9#featuredCollections"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -101451,18 +110816,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "streams", + ["https://www.w3.org/ns/activitystreams#streams"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -102017,18 +111386,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "movedTo", + ["https://www.w3.org/ns/activitystreams#movedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -102500,18 +111873,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -102665,18 +112042,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -103089,18 +112470,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -103254,18 +112639,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -103942,6 +113331,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -103965,8 +113355,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -103985,8 +113380,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104005,6 +113405,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { "@id": v.origin } ); @@ -104025,6 +113426,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { "@value": v } ); @@ -104045,8 +113447,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104065,8 +113476,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104085,8 +113505,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104105,8 +113530,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104125,8 +113555,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104145,8 +113580,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104165,8 +113605,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104185,8 +113630,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104205,8 +113655,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104225,8 +113680,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104245,6 +113705,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { "@value": v } ); @@ -104265,6 +113726,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { "@value": v } ); @@ -104285,6 +113747,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { "@value": v } ); @@ -104305,6 +113768,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { "@value": v } ); @@ -104325,6 +113789,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { "@value": v } ); @@ -104345,8 +113810,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104365,8 +113851,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104385,8 +113892,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -104405,6 +113917,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { "@value": v } ); @@ -104425,6 +113938,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { "@value": v } ); @@ -104445,6 +113959,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { "@id": formatIri(v) } ); @@ -104546,6 +114061,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://joinmastodon.org/ns#attributionDomains","http://joinmastodon.org/ns#discoverable","http://joinmastodon.org/ns#featured","http://joinmastodon.org/ns#featuredTags","http://joinmastodon.org/ns#indexable","http://joinmastodon.org/ns#memorial","http://joinmastodon.org/ns#suspended","http://purl.org/dc/terms/license","http://www.w3.org/ns/ldp#inbox","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_followedMessage","https://misskey-hub.net/ns#isCat","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/6757#preferredLicense","https://w3id.org/fep/7aa9#featuredCollections","https://w3id.org/fep/ef61/gateways","https://w3id.org/security#assertionMethod","https://w3id.org/security#proof","https://w3id.org/security#publicKey","https://www.w3.org/ns/activitystreams#alsoKnownAs","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#endpoints","https://www.w3.org/ns/activitystreams#followers","https://www.w3.org/ns/activitystreams#following","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#liked","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#movedTo","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#outbox","https://www.w3.org/ns/activitystreams#preferredUsername","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#streams","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/did#service"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -104678,6 +114195,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Group)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -104742,7 +114262,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -104783,7 +114308,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -104884,11 +114414,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -104931,11 +114471,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -104976,7 +114526,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105017,7 +114572,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105058,7 +114618,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105099,7 +114664,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105140,7 +114710,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105181,7 +114756,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105222,7 +114802,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105254,7 +114839,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105442,23 +115032,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -105500,23 +115115,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -105557,7 +115197,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -105662,6 +115307,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Group.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -106290,7 +115945,7 @@ get attributionDomains(): (string)[] { * the resource. * */ -export class Link { +export class Link implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -106306,6 +115961,14 @@ export class Link { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -106715,6 +116378,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -106756,6 +116423,7 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length < vocabSparseArrayMinimumLength ? this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice() : vocabCopyPropertyArray(this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href); if ("href" in values && values.href != null) { @@ -107064,9 +116732,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -107190,6 +116859,317 @@ deepCloneDescriptors.set(this.prototype, { } } } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Link, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#href", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#href", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#rel", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#rel", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#mediaType", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#mediaType", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/credentials/v2#digestMultibase", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/credentials/v2#digestMultibase", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#name", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#name", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#hreflang", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang) { + + let element = ( +{ "@value": v.baseName } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#hreflang", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#height", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#height", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#width", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#width", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preview", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Link ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preview", descriptor); + + descriptor = { + canonicalIri: "http://purl.org/dc/terms/license", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Link).#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://purl.org/dc/terms/license", descriptor); +descriptors.set("https://schema.org/license", descriptor); +descriptors.set("http://creativecommons.org/ns#license", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The target resource pointed to by a {@link Link}. */ @@ -107720,18 +117700,22 @@ get names(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#preview_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "preview", + ["https://www.w3.org/ns/activitystreams#preview"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -108015,6 +117999,7 @@ get licenses(): (URL)[] { const values: Record = {}; array = []; for (const v of this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href) { + let element = ( { "@id": formatIri(v) } ); @@ -108035,6 +118020,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel) { + let element = ( { "@value": v } ); @@ -108055,6 +118041,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { "@value": v } ); @@ -108075,6 +118062,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase) { + let element = ( { "@value": v } ); @@ -108095,6 +118083,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -108118,6 +118107,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang) { + let element = ( { "@value": v.baseName } ); @@ -108138,6 +118128,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -108161,6 +118152,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -108184,8 +118176,17 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Link ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Link ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -108204,6 +118205,7 @@ get licenses(): (URL)[] { array = []; for (const v of this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d) { + let element = ( { "@id": formatIri(v) } ); @@ -108289,6 +118291,8 @@ get licenses(): (URL)[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://purl.org/dc/terms/license","https://schema.org/license","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#href","https://www.w3.org/ns/activitystreams#hreflang","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#rel","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -108697,12 +118701,22 @@ get licenses(): (URL)[] { && 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -108756,6 +118770,16 @@ get licenses(): (URL)[] { } instance.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = _2rzkBRS4gNPrkJk9DohHAMUAxA2d; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Link.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -109097,6 +119121,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -109148,9 +119176,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -109313,6 +119342,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://purl.org/dc/terms/license","https://schema.org/license","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#href","https://www.w3.org/ns/activitystreams#hreflang","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#rel","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -109445,6 +119476,9 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Hashtag)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -109452,6 +119486,16 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Hashtag.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -109573,6 +119617,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -109638,9 +119686,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -109828,6 +119877,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -109960,6 +120011,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Image)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -109967,6 +120021,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Image.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -110097,6 +120161,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -110168,9 +120236,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -110345,6 +120414,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -110481,6 +120552,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Offer)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -110488,6 +120562,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Offer.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -110617,6 +120701,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -110688,9 +120776,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -110865,6 +120954,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -110997,6 +121088,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Invite)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -111004,6 +121098,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Invite.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -111133,6 +121237,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -111204,9 +121312,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -111381,6 +121490,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -111513,6 +121624,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Join)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -111520,6 +121634,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Join.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -111649,6 +121773,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -111720,9 +121848,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -111897,6 +122026,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -112029,6 +122160,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Leave)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -112036,6 +122170,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Leave.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -112165,6 +122309,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -112236,9 +122384,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -112413,6 +122562,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -112545,6 +122696,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Like)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -112552,6 +122706,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Like.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -112679,6 +122843,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -112750,9 +122918,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -112927,6 +123096,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -113059,6 +123230,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Listen)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -113066,6 +123240,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Listen.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -113173,6 +123357,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -113224,9 +123412,10 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -113389,6 +123578,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://purl.org/dc/terms/license","https://schema.org/license","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#href","https://www.w3.org/ns/activitystreams#hreflang","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#rel","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -113521,6 +123712,9 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Mention)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -113528,6 +123722,16 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Mention.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -113658,6 +123862,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -113729,9 +123937,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -113906,6 +124115,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -114038,6 +124249,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Move)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -114045,6 +124259,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Move.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -114214,6 +124438,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -114327,9 +124555,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -114457,6 +124686,103 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quote", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quote", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#quoteUrl", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ "@value": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#quoteUrl", descriptor); +descriptors.set("https://misskey-hub.net/ns#_misskey_quote", descriptor); +descriptors.set("http://fedibird.com/ns#quoteUri", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quoteAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Note).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quoteAuthorization", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchQuote( url: URL, @@ -114826,18 +125152,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quote", + ["https://w3id.org/fep/044f#quote"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -115270,18 +125600,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quoteAuthorization", + ["https://w3id.org/fep/044f#quoteAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -115457,8 +125791,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -115477,6 +125816,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { "@value": formatIri(v) } ); @@ -115501,8 +125841,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -115587,6 +125932,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://fedibird.com/ns#quoteUri","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_quote","https://schema.org/license","https://w3id.org/fep/044f#quote","https://w3id.org/fep/044f#quoteAuthorization","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#quoteUrl","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -115719,6 +126066,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Note)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -115750,7 +126100,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -115830,7 +126185,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -115847,6 +126207,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Note.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -116089,6 +126459,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -116213,9 +126587,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -116299,6 +126674,77 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#items", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollectionPage).#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Object ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#items", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#startIndex", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as OrderedCollectionPage).#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#startIndex", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchItem( url: URL, @@ -116686,18 +127132,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#item_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "orderedItems", + ["https://www.w3.org/ns/activitystreams#items"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -116860,8 +127310,17 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Object ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -116880,6 +127339,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -116969,6 +127429,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/5711#followersOf","https://w3id.org/fep/5711#followingOf","https://w3id.org/fep/5711#inboxOf","https://w3id.org/fep/5711#likedOf","https://w3id.org/fep/5711#likesOf","https://w3id.org/fep/5711#outboxOf","https://w3id.org/fep/5711#repliesOf","https://w3id.org/fep/5711#sharesOf","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#current","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#first","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#items","https://www.w3.org/ns/activitystreams#last","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#next","https://www.w3.org/ns/activitystreams#partOf","https://www.w3.org/ns/activitystreams#prev","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startIndex","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#totalItems","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -117101,6 +127563,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof OrderedCollectionPage)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -117134,12 +127599,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; && 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/fep/7aa9#FeatureAuthorization","https://w3id.org/fep/7aa9#FeaturedItem","https://w3id.org/valueflows/ont/vf#Agreement","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://w3id.org/fep/7aa9#FeatureRequest","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://w3id.org/fep/7aa9#FeaturedCollection","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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -117185,6 +127660,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = _2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + OrderedCollectionPage.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -118090,6 +128575,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -118915,9 +129404,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -119359,6 +129849,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preferredUsername", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preferredUsername", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKey", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#assertionMethod", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#assertionMethod", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/ef61/gateways", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ "@id": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://w3id.org/fep/ef61/gateways", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", descriptor); + + descriptor = { + canonicalIri: "http://www.w3.org/ns/ldp#inbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.w3.org/ns/ldp#inbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#outbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#outbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#following", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#following", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#followers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#followers", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#liked", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#liked", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featured", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featured", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featuredTags", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featuredTags", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featuredCollections", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featuredCollections", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#streams", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#streams", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#endpoints", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#endpoints", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#discoverable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#discoverable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#suspended", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#suspended", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#memorial", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#memorial", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#indexable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#indexable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#attributionDomains", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#attributionDomains", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#movedTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#movedTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#alsoKnownAs", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#alsoKnownAs", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/did#service", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/did#service", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#_misskey_followedMessage", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#_misskey_followedMessage", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#isCat", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#isCat", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/6757#preferredLicense", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Organization).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/6757#preferredLicense", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -119748,18 +131049,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -119909,18 +131214,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -120333,18 +131642,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -120498,18 +131811,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -120992,18 +132309,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inbox", + ["http://www.w3.org/ns/ldp#inbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -121436,18 +132757,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "outbox", + ["https://www.w3.org/ns/activitystreams#outbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -121860,18 +133185,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "following", + ["https://www.w3.org/ns/activitystreams#following"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -122287,18 +133616,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followers", + ["https://www.w3.org/ns/activitystreams#followers"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -122712,18 +134045,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "liked", + ["https://www.w3.org/ns/activitystreams#liked"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -123135,18 +134472,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featured", + ["http://joinmastodon.org/ns#featured"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -123558,18 +134899,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredTags", + ["http://joinmastodon.org/ns#featuredTags"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -123978,18 +135323,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredCollections", + ["https://w3id.org/fep/7aa9#featuredCollections"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -124402,18 +135751,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "streams", + ["https://www.w3.org/ns/activitystreams#streams"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -124968,18 +136321,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "movedTo", + ["https://www.w3.org/ns/activitystreams#movedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -125451,18 +136808,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -125616,18 +136977,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -126040,18 +137405,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -126205,18 +137574,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -126893,6 +138266,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -126916,8 +138290,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -126936,8 +138315,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -126956,6 +138340,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { "@id": v.origin } ); @@ -126976,6 +138361,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { "@value": v } ); @@ -126996,8 +138382,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127016,8 +138411,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127036,8 +138440,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127056,8 +138465,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127076,8 +138490,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127096,8 +138515,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127116,8 +138540,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127136,8 +138565,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127156,8 +138590,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127176,8 +138615,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127196,6 +138640,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { "@value": v } ); @@ -127216,6 +138661,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { "@value": v } ); @@ -127236,6 +138682,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { "@value": v } ); @@ -127256,6 +138703,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { "@value": v } ); @@ -127276,6 +138724,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { "@value": v } ); @@ -127296,8 +138745,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127316,8 +138786,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127336,8 +138827,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -127356,6 +138852,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { "@value": v } ); @@ -127376,6 +138873,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { "@value": v } ); @@ -127396,6 +138894,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { "@id": formatIri(v) } ); @@ -127497,6 +138996,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://joinmastodon.org/ns#attributionDomains","http://joinmastodon.org/ns#discoverable","http://joinmastodon.org/ns#featured","http://joinmastodon.org/ns#featuredTags","http://joinmastodon.org/ns#indexable","http://joinmastodon.org/ns#memorial","http://joinmastodon.org/ns#suspended","http://purl.org/dc/terms/license","http://www.w3.org/ns/ldp#inbox","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_followedMessage","https://misskey-hub.net/ns#isCat","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/6757#preferredLicense","https://w3id.org/fep/7aa9#featuredCollections","https://w3id.org/fep/ef61/gateways","https://w3id.org/security#assertionMethod","https://w3id.org/security#proof","https://w3id.org/security#publicKey","https://www.w3.org/ns/activitystreams#alsoKnownAs","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#endpoints","https://www.w3.org/ns/activitystreams#followers","https://www.w3.org/ns/activitystreams#following","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#liked","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#movedTo","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#outbox","https://www.w3.org/ns/activitystreams#preferredUsername","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#streams","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/did#service"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -127629,6 +139130,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Organization)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -127693,7 +139197,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127734,7 +139243,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127835,11 +139349,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -127882,11 +139406,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -127927,7 +139461,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -127968,7 +139507,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128009,7 +139553,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128050,7 +139599,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128091,7 +139645,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128132,7 +139691,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128173,7 +139737,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128205,7 +139774,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128393,23 +139967,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -128451,23 +140050,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -128508,7 +140132,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -128613,6 +140242,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Organization.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -129294,6 +140933,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -129359,9 +141002,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -129549,6 +141193,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -129681,6 +141327,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Page)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -129688,6 +141337,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Page.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -130551,6 +142210,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -131376,9 +143039,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -131820,6 +143484,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preferredUsername", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preferredUsername", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKey", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#assertionMethod", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#assertionMethod", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/ef61/gateways", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ "@id": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://w3id.org/fep/ef61/gateways", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", descriptor); + + descriptor = { + canonicalIri: "http://www.w3.org/ns/ldp#inbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.w3.org/ns/ldp#inbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#outbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#outbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#following", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#following", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#followers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#followers", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#liked", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#liked", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featured", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featured", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featuredTags", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featuredTags", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featuredCollections", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featuredCollections", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#streams", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#streams", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#endpoints", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#endpoints", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#discoverable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#discoverable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#suspended", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#suspended", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#memorial", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#memorial", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#indexable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#indexable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#attributionDomains", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#attributionDomains", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#movedTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#movedTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#alsoKnownAs", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#alsoKnownAs", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/did#service", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/did#service", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#_misskey_followedMessage", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#_misskey_followedMessage", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#isCat", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#isCat", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/6757#preferredLicense", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Person).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/6757#preferredLicense", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -132209,18 +144684,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -132370,18 +144849,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -132794,18 +145277,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -132959,18 +145446,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -133453,18 +145944,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inbox", + ["http://www.w3.org/ns/ldp#inbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -133897,18 +146392,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "outbox", + ["https://www.w3.org/ns/activitystreams#outbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -134321,18 +146820,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "following", + ["https://www.w3.org/ns/activitystreams#following"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -134748,18 +147251,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followers", + ["https://www.w3.org/ns/activitystreams#followers"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -135173,18 +147680,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "liked", + ["https://www.w3.org/ns/activitystreams#liked"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -135596,18 +148107,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featured", + ["http://joinmastodon.org/ns#featured"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -136019,18 +148534,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredTags", + ["http://joinmastodon.org/ns#featuredTags"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -136439,18 +148958,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredCollections", + ["https://w3id.org/fep/7aa9#featuredCollections"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -136863,18 +149386,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "streams", + ["https://www.w3.org/ns/activitystreams#streams"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -137429,18 +149956,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "movedTo", + ["https://www.w3.org/ns/activitystreams#movedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -137912,18 +150443,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -138077,18 +150612,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -138501,18 +151040,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -138666,18 +151209,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -139354,6 +151901,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -139377,8 +151925,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139397,8 +151950,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139417,6 +151975,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { "@id": v.origin } ); @@ -139437,6 +151996,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { "@value": v } ); @@ -139457,8 +152017,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139477,8 +152046,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139497,8 +152075,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139517,8 +152100,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139537,8 +152125,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139557,8 +152150,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139577,8 +152175,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139597,8 +152200,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139617,8 +152225,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139637,8 +152250,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139657,6 +152275,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { "@value": v } ); @@ -139677,6 +152296,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { "@value": v } ); @@ -139697,6 +152317,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { "@value": v } ); @@ -139717,6 +152338,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { "@value": v } ); @@ -139737,6 +152359,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { "@value": v } ); @@ -139757,8 +152380,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139777,8 +152421,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139797,8 +152462,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -139817,6 +152487,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { "@value": v } ); @@ -139837,6 +152508,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { "@value": v } ); @@ -139857,6 +152529,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { "@id": formatIri(v) } ); @@ -139958,6 +152631,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://joinmastodon.org/ns#attributionDomains","http://joinmastodon.org/ns#discoverable","http://joinmastodon.org/ns#featured","http://joinmastodon.org/ns#featuredTags","http://joinmastodon.org/ns#indexable","http://joinmastodon.org/ns#memorial","http://joinmastodon.org/ns#suspended","http://purl.org/dc/terms/license","http://www.w3.org/ns/ldp#inbox","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_followedMessage","https://misskey-hub.net/ns#isCat","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/6757#preferredLicense","https://w3id.org/fep/7aa9#featuredCollections","https://w3id.org/fep/ef61/gateways","https://w3id.org/security#assertionMethod","https://w3id.org/security#proof","https://w3id.org/security#publicKey","https://www.w3.org/ns/activitystreams#alsoKnownAs","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#endpoints","https://www.w3.org/ns/activitystreams#followers","https://www.w3.org/ns/activitystreams#following","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#liked","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#movedTo","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#outbox","https://www.w3.org/ns/activitystreams#preferredUsername","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#streams","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/did#service"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -140090,6 +152765,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Person)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -140154,7 +152832,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140195,7 +152878,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140296,11 +152984,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140343,11 +153041,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140388,7 +153096,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140429,7 +153142,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140470,7 +153188,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140511,7 +153234,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140552,7 +153280,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140593,7 +153326,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140634,7 +153372,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140666,7 +153409,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -140854,23 +153602,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140912,23 +153685,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -140969,7 +153767,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -141074,6 +153877,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Person.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -141842,6 +154655,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -141991,9 +154808,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -142077,6 +154895,189 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#accuracy", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#float", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#accuracy", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#altitude", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#float", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#altitude", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#latitude", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#float", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#latitude", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#longitude", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#float", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#longitude", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#radius", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#float", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#radius", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#units", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Place).#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units) { + + let element = ( +v == "cm" || v == "feet" || v == "inches" || v == "km" || v == "m" || v == "miles" ?{ "@value": v } :{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#units", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** Indicates the accuracy of position coordinates on a {@link Place} objects. * Expressed in properties of percentage. e.g. "94.0" means "94.0% accurate". @@ -142331,6 +155332,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#float", @@ -142354,6 +155356,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#float", @@ -142377,6 +155380,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#float", @@ -142400,6 +155404,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#float", @@ -142423,6 +155428,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#float", @@ -142446,6 +155452,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units) { + let element = ( v == "cm" || v == "feet" || v == "inches" || v == "km" || v == "m" || v == "miles" ? { "@value": v } : { "@id": formatIri(v) } ); @@ -142532,6 +155539,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#accuracy","https://www.w3.org/ns/activitystreams#altitude","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#latitude","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#longitude","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#radius","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#units","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -142664,6 +155673,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Place)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -142848,6 +155860,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = _oKrwxU4V8wiKhMW1QEYQibcJh8c_units; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Place.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -143110,6 +156132,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -143192,9 +156218,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -143278,6 +156305,43 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#describes", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Profile).#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#describes", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchDescribes( url: URL, @@ -143646,18 +156710,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#describes_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "describes", + ["https://www.w3.org/ns/activitystreams#describes"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -143787,8 +156855,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -143873,6 +156946,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#describes","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -144005,6 +157080,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Profile)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -144036,7 +157114,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -144053,6 +157136,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Profile.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -144370,6 +157463,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -144607,9 +157704,10 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -144787,6 +157885,225 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#oneOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#oneOf", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#anyOf", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#anyOf", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#closed", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) { + + let element = ( +isTemporalInstant(v) ?{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } :{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#closed", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#votersCount", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", + "@value": v, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#votersCount", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quote", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quote", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#quoteUrl", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + + let element = ( +{ "@value": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#quoteUrl", descriptor); +descriptors.set("https://misskey-hub.net/ns#_misskey_quote", descriptor); +descriptors.set("http://fedibird.com/ns#quoteUri", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/044f#quoteAuthorization", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Question).#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/044f#quoteAuthorization", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchExclusiveOption( url: URL, @@ -145160,18 +158477,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#exclusiveOption_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "oneOf", + ["https://www.w3.org/ns/activitystreams#oneOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -145587,18 +158908,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#inclusiveOption_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "anyOf", + ["https://www.w3.org/ns/activitystreams#anyOf"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -146040,18 +159365,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quote_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quote", + ["https://w3id.org/fep/044f#quote"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -146484,18 +159813,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#quoteAuthorization_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "quoteAuthorization", + ["https://w3id.org/fep/044f#quoteAuthorization"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -146586,8 +159919,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146606,8 +159944,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146626,6 +159969,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) { + let element = ( isTemporalInstant(v) ? { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -146649,6 +159993,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger", @@ -146672,8 +160017,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146692,6 +160042,7 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl) { + let element = ( { "@value": formatIri(v) } ); @@ -146716,8 +160067,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -146802,6 +160158,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://fedibird.com/ns#quoteUri","http://joinmastodon.org/ns#votersCount","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_quote","https://schema.org/license","https://w3id.org/fep/044f#quote","https://w3id.org/fep/044f#quoteAuthorization","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#anyOf","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#closed","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#oneOf","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#quoteUrl","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -146934,6 +160292,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Question)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -146965,7 +160326,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147006,7 +160372,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147115,7 +160486,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147195,7 +160571,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await QuoteAuthorization.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -147212,6 +160593,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Question.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -147484,6 +160875,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -147555,9 +160950,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -147732,6 +161128,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -147864,6 +161262,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Read)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -147871,6 +161272,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Read.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -148000,6 +161411,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -148071,9 +161486,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -148248,6 +161664,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -148384,6 +161802,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Reject)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -148391,6 +161812,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Reject.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -148667,6 +162098,10 @@ relationships?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -148885,9 +162320,10 @@ relationships?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -149017,6 +162453,105 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#subject", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#subject", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#object", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#object", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#relationship", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Relationship).#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#relationship", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} async #fetchSubject( url: URL, @@ -149387,18 +162922,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#subject_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "subject", + ["https://www.w3.org/ns/activitystreams#subject"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -149807,18 +163346,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#object_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "object", + ["https://www.w3.org/ns/activitystreams#object"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -149969,18 +163512,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#object_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "object", + ["https://www.w3.org/ns/activitystreams#object"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -150392,18 +163939,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#relationship_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "relationship", + ["https://www.w3.org/ns/activitystreams#relationship"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -150556,18 +164107,22 @@ const base = getDeepCloneDescriptor(this.prototype)!; const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#relationship_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "relationship", + ["https://www.w3.org/ns/activitystreams#relationship"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -150738,8 +164293,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150758,8 +164318,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150778,8 +164343,13 @@ const base = getDeepCloneDescriptor(this.prototype)!; array = []; for (const v of this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -150864,6 +164434,8 @@ const base = getDeepCloneDescriptor(this.prototype)!; return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#relationship","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#subject","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -150996,6 +164568,9 @@ const base = getDeepCloneDescriptor(this.prototype)!; ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Relationship)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -151027,7 +164602,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151068,7 +164648,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151109,7 +164694,12 @@ const base = getDeepCloneDescriptor(this.prototype)!; const decoded = await Object.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -151126,6 +164716,16 @@ const base = getDeepCloneDescriptor(this.prototype)!; } instance.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Relationship.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -151327,6 +164927,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -151398,9 +165002,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -151575,6 +165180,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -151707,6 +165314,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Remove)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -151714,6 +165324,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Remove.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -152577,6 +166197,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -153402,9 +167026,10 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -153846,6 +167471,817 @@ const base = getDeepCloneDescriptor(this.prototype)!; } } } }); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#preferredUsername", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#preferredUsername", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#publicKey", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#publicKey", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/security#assertionMethod", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/security#assertionMethod", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/ef61/gateways", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + + let element = ( +{ "@id": v.origin } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return { "@list": array }; + }, + }; + descriptors.set("https://w3id.org/fep/ef61/gateways", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", descriptor); + + descriptor = { + canonicalIri: "http://www.w3.org/ns/ldp#inbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://www.w3.org/ns/ldp#inbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#outbox", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof OrderedCollection ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#outbox", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#following", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#following", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#followers", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#followers", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#liked", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#liked", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featured", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featured", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#featuredTags", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#featuredTags", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/7aa9#featuredCollections", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/7aa9#featuredCollections", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#streams", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#streams", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#endpoints", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + + let element = ( +await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#endpoints", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#discoverable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#discoverable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#suspended", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#suspended", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#memorial", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#memorial", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#indexable", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#indexable", descriptor); + + descriptor = { + canonicalIri: "http://joinmastodon.org/ns#attributionDomains", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("http://joinmastodon.org/ns#attributionDomains", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#movedTo", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#movedTo", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#alsoKnownAs", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :v instanceof Application ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Group ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Organization ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :v instanceof Person ?await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#alsoKnownAs", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/did#service", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + + let element = ( +v instanceof URL ? { "@id": formatIri(v) } :await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/did#service", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#_misskey_followedMessage", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#_misskey_followedMessage", descriptor); + + descriptor = { + canonicalIri: "https://misskey-hub.net/ns#isCat", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://misskey-hub.net/ns#isCat", descriptor); + + descriptor = { + canonicalIri: "https://w3id.org/fep/6757#preferredLicense", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Service).#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + + let element = ( +{ "@id": formatIri(v) } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://w3id.org/fep/6757#preferredLicense", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. @@ -154235,18 +168671,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#publicKey_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -154396,18 +168836,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#publicKey_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "publicKey", + ["https://w3id.org/security#publicKey"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -154820,18 +169264,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#assertionMethod_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -154985,18 +169433,22 @@ get preferredUsernames(): ((string | LanguageString))[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#assertionMethod_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "assertionMethod", + ["https://w3id.org/security#assertionMethod"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -155479,18 +169931,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#inbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "inbox", + ["http://www.w3.org/ns/ldp#inbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -155923,18 +170379,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#outbox_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "outbox", + ["https://www.w3.org/ns/activitystreams#outbox"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -156347,18 +170807,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#following_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "following", + ["https://www.w3.org/ns/activitystreams#following"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -156774,18 +171238,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#followers_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "followers", + ["https://www.w3.org/ns/activitystreams#followers"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -157199,18 +171667,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#liked_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "liked", + ["https://www.w3.org/ns/activitystreams#liked"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -157622,18 +172094,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featured_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featured", + ["http://joinmastodon.org/ns#featured"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -158045,18 +172521,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredTags_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredTags", + ["http://joinmastodon.org/ns#featuredTags"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -158465,18 +172945,22 @@ get gateways(): (URL)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#featuredCollections_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "featuredCollections", + ["https://w3id.org/fep/7aa9#featuredCollections"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -158889,18 +173373,22 @@ get gateways(): (URL)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#stream_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "streams", + ["https://www.w3.org/ns/activitystreams#streams"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -159455,18 +173943,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#successor_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "movedTo", + ["https://www.w3.org/ns/activitystreams#movedTo"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -159938,18 +174430,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#alias_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -160103,18 +174599,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#alias_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "alsoKnownAs", + ["https://www.w3.org/ns/activitystreams#alsoKnownAs"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -160527,18 +175027,22 @@ get attributionDomains(): (string)[] { const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#service_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -160692,18 +175196,22 @@ get attributionDomains(): (string)[] { const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#service_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: (options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined), - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + "service", + ["https://www.w3.org/ns/did#service"], + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -161380,6 +175888,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -161403,8 +175912,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161423,8 +175937,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161443,6 +175962,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_hQiaHhZP8hqxckxTBrpsGNs57E3) { + let element = ( { "@id": v.origin } ); @@ -161463,6 +175983,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers) { + let element = ( { "@value": v } ); @@ -161483,8 +176004,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161503,8 +176033,17 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof OrderedCollection ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161523,8 +176062,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161543,8 +176087,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161563,8 +176112,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161583,8 +176137,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161603,8 +176162,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161623,8 +176187,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161643,8 +176212,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161663,8 +176237,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints) { + let element = ( - await v.toJsonLd(options) + await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161683,6 +176262,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable) { + let element = ( { "@value": v } ); @@ -161703,6 +176283,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended) { + let element = ( { "@value": v } ); @@ -161723,6 +176304,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial) { + let element = ( { "@value": v } ); @@ -161743,6 +176325,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable) { + let element = ( { "@value": v } ); @@ -161763,6 +176346,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4QMetaJKCxkz7wX64M2TuXRgNjB6_attributionDomains) { + let element = ( { "@value": v } ); @@ -161783,8 +176367,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161803,8 +176408,29 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await v.toJsonLd(options) : v instanceof Group ? await v.toJsonLd(options) : v instanceof Organization ? await v.toJsonLd(options) : v instanceof Person ? await v.toJsonLd(options) : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : v instanceof Application ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Group ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Organization ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : v instanceof Person ? await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + ) : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161823,8 +176449,13 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service) { + let element = ( - retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await v.toJsonLd(options)) + retainedSignedValueRef(v, signedValues.scope) ?? (v instanceof URL ? { "@id": formatIri(v) } : await encodeNestedVocabularyValue( + options, + v, + () => v.toJsonLd(options), + )) ); if (Array.isArray(element)) { if (element.length < 1) continue; @@ -161843,6 +176474,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage) { + let element = ( { "@value": v } ); @@ -161863,6 +176495,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat) { + let element = ( { "@value": v } ); @@ -161883,6 +176516,7 @@ get attributionDomains(): (string)[] { array = []; for (const v of this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense) { + let element = ( { "@id": formatIri(v) } ); @@ -161984,6 +176618,8 @@ get attributionDomains(): (string)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://joinmastodon.org/ns#attributionDomains","http://joinmastodon.org/ns#discoverable","http://joinmastodon.org/ns#featured","http://joinmastodon.org/ns#featuredTags","http://joinmastodon.org/ns#indexable","http://joinmastodon.org/ns#memorial","http://joinmastodon.org/ns#suspended","http://purl.org/dc/terms/license","http://www.w3.org/ns/ldp#inbox","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://misskey-hub.net/ns#_misskey_followedMessage","https://misskey-hub.net/ns#isCat","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/fep/6757#preferredLicense","https://w3id.org/fep/7aa9#featuredCollections","https://w3id.org/fep/ef61/gateways","https://w3id.org/security#assertionMethod","https://w3id.org/security#proof","https://w3id.org/security#publicKey","https://www.w3.org/ns/activitystreams#alsoKnownAs","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#endpoints","https://www.w3.org/ns/activitystreams#followers","https://www.w3.org/ns/activitystreams#following","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#liked","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#movedTo","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#outbox","https://www.w3.org/ns/activitystreams#preferredUsername","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#streams","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/did#service"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -162116,6 +176752,9 @@ get attributionDomains(): (string)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Service)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -162180,7 +176819,12 @@ get attributionDomains(): (string)[] { const decoded = await CryptographicKey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162221,7 +176865,12 @@ get attributionDomains(): (string)[] { const decoded = await Multikey.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162322,11 +176971,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162369,11 +177028,21 @@ get attributionDomains(): (string)[] { && Array.isArray(v["@type"])&& ["https://www.w3.org/ns/activitystreams#OrderedCollection","https://w3id.org/fep/7aa9#FeaturedCollection"].some( t => v["@type"].includes(t)) ? await OrderedCollection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162414,7 +177083,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162455,7 +177129,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162496,7 +177175,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162537,7 +177221,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162578,7 +177267,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162619,7 +177313,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162660,7 +177359,12 @@ get attributionDomains(): (string)[] { const decoded = await Collection.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162692,7 +177396,12 @@ get attributionDomains(): (string)[] { const decoded = await Endpoints.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -162880,23 +177589,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162938,23 +177672,48 @@ get attributionDomains(): (string)[] { 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : 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: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) : undefined ; @@ -162995,7 +177754,12 @@ get attributionDomains(): (string)[] { const decoded = await DidService.fromJsonLd( v, - { ...options, baseUrl: options.baseUrl } + { + ...options, + baseUrl: options.baseUrl, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } ) ; @@ -163100,6 +177864,16 @@ get attributionDomains(): (string)[] { } instance.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = _248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Service.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -163720,7 +178494,7 @@ get attributionDomains(): (string)[] { }; /** Contents of {@link Object}'s \`source\`. */ -export class Source { +export class Source implements VocabularyObject { readonly #documentLoader?: DocumentLoader; readonly #contextLoader?: DocumentLoader; @@ -163736,6 +178510,14 @@ export class Source { #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -163929,6 +178711,10 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -163969,6 +178755,7 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if ("content" in values && values.content != null) { @@ -164061,9 +178848,10 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -164120,6 +178908,85 @@ deepCloneDescriptors.set(this.prototype, { const identified = node as { id: URL | null }; identified.id = context.value(identified.id); } }); } +static { + + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: Source, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#content", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Source).#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + + let element = ( +typeof v === "string" ?{ "@value": v } :{ + "@value": v.toString(), + "@language": v.locale.baseName, + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#content", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#mediaType", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Source).#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + + let element = ( +{ "@value": v } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#mediaType", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** The source content. */ @@ -164239,6 +179106,7 @@ get contents(): ((string | LanguageString))[] { const values: Record = {}; array = []; for (const v of this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content) { + let element = ( typeof v === "string" ? { "@value": v } : { "@value": v.toString(), @@ -164262,6 +179130,7 @@ get contents(): ((string | LanguageString))[] { array = []; for (const v of this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType) { + let element = ( { "@value": v } ); @@ -164342,6 +179211,8 @@ get contents(): ((string | LanguageString))[] { return true; } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#mediaType"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -164540,6 +179411,16 @@ get contents(): ((string | LanguageString))[] { } instance.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = _3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Source.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -164730,6 +179611,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -164801,9 +179686,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -164978,6 +179864,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -165110,6 +179998,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof TentativeAccept)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -165117,6 +180008,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + TentativeAccept.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -165246,6 +180147,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -165317,9 +180222,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -165494,6 +180400,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -165626,6 +180534,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof TentativeReject)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -165633,6 +180544,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + TentativeReject.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -165833,6 +180754,10 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -165974,9 +180899,10 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -166031,6 +180957,69 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} }; return deepCloneGraph(this, this.clone(values, cloneOptions)); } +static { + + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#formerType", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Tombstone).#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType) { + + let element = ( +{ "@id": v.typeId.href } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#formerType", descriptor); + + descriptor = { + canonicalIri: "https://www.w3.org/ns/activitystreams#deleted", + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as Tombstone).#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted) { + + let element = ( +{ + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + "@value": v.toString(), + } + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; +array.push(element); + } + if (array.length < 1) return undefined; + return array; + }, + }; + descriptors.set("https://www.w3.org/ns/activitystreams#deleted", descriptor); +rawPropertyDescriptors.set(this.prototype, descriptors); +} /** On a \`Tombstone\` object, the \`formerType\` property identifies the type of * the object that was deleted. @@ -166169,6 +181158,7 @@ get formerTypes(): ($EntityType)[] { array = []; for (const v of this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType) { + let element = ( { "@id": v.typeId.href } ); @@ -166189,6 +181179,7 @@ get formerTypes(): ($EntityType)[] { array = []; for (const v of this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted) { + let element = ( { "@type": "http://www.w3.org/2001/XMLSchema#dateTime", @@ -166283,6 +181274,8 @@ get formerTypes(): ($EntityType)[] { return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#deleted","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#formerType","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -166415,6 +181408,9 @@ get formerTypes(): ($EntityType)[] { ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Tombstone)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -166497,6 +181493,16 @@ get formerTypes(): ($EntityType)[] { } instance.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Tombstone.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -166674,6 +181680,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -166745,9 +181755,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -166922,6 +181933,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -167054,6 +182067,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Travel)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -167061,6 +182077,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Travel.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -167195,6 +182221,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -167266,9 +182296,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -167443,6 +182474,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -167575,6 +182608,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Undo)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -167582,6 +182618,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Undo.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -167714,6 +182760,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -167785,9 +182835,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -167962,6 +183013,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -168094,6 +183147,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Update)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -168101,6 +183157,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Update.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -168222,6 +183288,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -168287,9 +183357,10 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -168477,6 +183548,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#height","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url","https://www.w3.org/ns/activitystreams#width","https://www.w3.org/ns/credentials/v2#digestMultibase"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -168609,6 +183682,9 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof Video)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -168616,6 +183692,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + Video.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && @@ -168744,6 +183830,10 @@ instruments?: (Object | URL)[];} * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -168815,9 +183905,10 @@ instruments?: (Object | URL)[];} * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; @@ -168992,6 +184083,8 @@ instruments?: (Object | URL)[];} return super.isCompactable(); } + static readonly #knownRawPropertyIris: ReadonlySet = new Set(["http://creativecommons.org/ns#license","http://fedibird.com/ns#emojiReactions","http://purl.org/dc/terms/license","https://gotosocial.org/ns#announceAuthorization","https://gotosocial.org/ns#approvedBy","https://gotosocial.org/ns#interactionPolicy","https://gotosocial.org/ns#likeAuthorization","https://gotosocial.org/ns#replyAuthorization","https://schema.org/license","https://w3id.org/fep/22cd#translations","https://w3id.org/security#proof","https://www.w3.org/ns/activitystreams#actor","https://www.w3.org/ns/activitystreams#attachment","https://www.w3.org/ns/activitystreams#attributedTo","https://www.w3.org/ns/activitystreams#audience","https://www.w3.org/ns/activitystreams#bcc","https://www.w3.org/ns/activitystreams#bto","https://www.w3.org/ns/activitystreams#cc","https://www.w3.org/ns/activitystreams#content","https://www.w3.org/ns/activitystreams#context","https://www.w3.org/ns/activitystreams#duration","https://www.w3.org/ns/activitystreams#endTime","https://www.w3.org/ns/activitystreams#generator","https://www.w3.org/ns/activitystreams#icon","https://www.w3.org/ns/activitystreams#image","https://www.w3.org/ns/activitystreams#inReplyTo","https://www.w3.org/ns/activitystreams#instrument","https://www.w3.org/ns/activitystreams#likes","https://www.w3.org/ns/activitystreams#location","https://www.w3.org/ns/activitystreams#mediaType","https://www.w3.org/ns/activitystreams#name","https://www.w3.org/ns/activitystreams#object","https://www.w3.org/ns/activitystreams#origin","https://www.w3.org/ns/activitystreams#preview","https://www.w3.org/ns/activitystreams#published","https://www.w3.org/ns/activitystreams#replies","https://www.w3.org/ns/activitystreams#result","https://www.w3.org/ns/activitystreams#sensitive","https://www.w3.org/ns/activitystreams#shares","https://www.w3.org/ns/activitystreams#source","https://www.w3.org/ns/activitystreams#startTime","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#tag","https://www.w3.org/ns/activitystreams#target","https://www.w3.org/ns/activitystreams#to","https://www.w3.org/ns/activitystreams#updated","https://www.w3.org/ns/activitystreams#url"]); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -169124,6 +184217,9 @@ instruments?: (Object | URL)[];} ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof View)) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -169131,6 +184227,16 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + View.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && diff --git a/packages/vocab-tools/src/class.ts b/packages/vocab-tools/src/class.ts index ef1d497ad..cb6e21a63 100644 --- a/packages/vocab-tools/src/class.ts +++ b/packages/vocab-tools/src/class.ts @@ -11,6 +11,10 @@ import { import { generateFields } from "./field.ts"; import { generateInspector, generateInspectorPostClass } from "./inspector.ts"; import { generateProperties } from "./property.ts"; +import { + generateRawPropertyDescriptors, + generateRawPropertyHelpers, +} from "./raw-property.ts"; import { generatePropertyArrayHelpers } from "./property-array.ts"; import { type PropertySchema, @@ -49,6 +53,16 @@ const PORTABLE_DEREFERENCE_IMPORTS = [ "rejectMalformedCompatibleReference", "warnUnverifiableEmbeddedObject", ].join(",\n "); +const RAW_PROPERTY_IMPORTS = [ + "createRawPropertyEncodingOptions", + "encodeNestedVocabularyValue", + "expandRawPropertyValue", + "RAW_PROPERTY_PROTOCOL", + "type RawPropertyRequest", + "readRawPropertyValues", + "retainRawProperties", + "type RetainedRawProperties", +].join(",\n "); const SIGNED_REPRESENTATION_IMPORTS = [ "enterSignedValueScope", "resolveSignedValues", @@ -75,7 +89,9 @@ const RUNTIME_IMPORTS = [ "parseIri", "parseJsonLdId", "type PortableObjectVerifier", + "type RawPropertyValue", "type RemoteDocument", + "type VocabularyObject", ].join(",\n "); /** @@ -117,7 +133,7 @@ async function* generateClass( const baseType = types[type.extends]; yield `export class ${type.name} extends ${baseType.name} {\n`; } else { - yield `export class ${type.name} {\n`; + yield `export class ${type.name} implements VocabularyObject {\n`; } if (type.extends == null) { yield ` @@ -135,6 +151,14 @@ async function* generateClass( #shouldCacheJsonLd = true; readonly id: URL | null; + /** + * Marks this object as a {@link VocabularyObject}. It is always \`true\`. + * @since 2.5.0 + */ + get "~fedify.vocab"(): true { + return true; + } + protected get _documentLoader(): DocumentLoader | undefined { return this.#documentLoader; } @@ -208,6 +232,9 @@ async function* generateClass( for await (const code of generateDeepCloneDescriptor(typeUri, types)) { yield code.replace(/[ \t]+$/gm, ""); } + for await (const code of generateRawPropertyDescriptors(typeUri, types)) { + yield code.replace(/[ \t]+$/gm, ""); + } for await (const code of generateProperties(typeUri, types, moduleVarNames)) { yield code; } @@ -324,6 +351,7 @@ export async function* generateClasses( yield `import {\n ${RUNTIME_IMPORTS}\n} from "@fedify/vocab-runtime";\n`; yield `import {\n ${INTERNAL_RUNTIME_IMPORTS}\n} from "@fedify/vocab-runtime/internal/jsonld-cache";\n`; yield `import {\n ${PORTABLE_DEREFERENCE_IMPORTS}\n} from "@fedify/vocab-runtime/internal/portable-dereference";\n`; + yield `import {\n ${RAW_PROPERTY_IMPORTS}\n} from "@fedify/vocab-runtime/internal/raw-property";\n`; yield `import {\n ${SIGNED_REPRESENTATION_IMPORTS}\n} from "@fedify/vocab-runtime/internal/signed-representation";\n`; yield `import { isTemporalDuration, @@ -348,6 +376,7 @@ function inspectIri(iri: URL): string { `; yield generatePropertyArrayHelpers(); yield generateDeepCloneHelpers(); + yield generateRawPropertyHelpers(); yield ` function isValidLanguageTag(language: string): boolean { try { diff --git a/packages/vocab-tools/src/codec.ts b/packages/vocab-tools/src/codec.ts index eb6db033e..35397f5d9 100644 --- a/packages/vocab-tools/src/codec.ts +++ b/packages/vocab-tools/src/codec.ts @@ -2,6 +2,10 @@ import metadata from "../deno.json" with { type: "json" }; import { generateField, getFieldName } from "./field.ts"; import type { PropertyPreprocessorSchema, TypeSchema } from "./schema.ts"; import { isNonFunctionalProperty } from "./schema.ts"; +import { + generateExpandedPropertyElement, + getKnownPropertyIris, +} from "./raw-property.ts"; import { areAllScalarTypes, emitOverride, @@ -223,29 +227,12 @@ export async function* generateEncoder( yield ` array = []; for (const v of this.${await getFieldName(property.uri)}) { - let element = ( `; - if (!areAllScalarTypes(property.range, types)) { - yield "retainedSignedValueRef(v, signedValues.scope) ?? ("; - yield 'v instanceof URL ? { "@id": formatIri(v) } : '; - } - for (const code of getEncoders(property.range, types, "v", "options")) { - yield code; - } - if (!areAllScalarTypes(property.range, types)) yield ")"; - yield ` - ); - if (Array.isArray(element)) { - if (element.length < 1) continue; - if (element.length == 1) element = element[0]; - } - if (typeof element === "undefined") continue; - `; - if (isNonFunctionalProperty(property) && property.container === "graph") { - yield `array.push({ "@graph": element });`; - } else { - yield `array.push(element);`; - } + yield* generateExpandedPropertyElement( + property, + types, + "signedValues.scope", + ); yield `; } if (array.length > 0) { @@ -400,6 +387,10 @@ export async function* generateDecoder( ): AsyncIterable { const type = types[typeUri]; yield ` + static readonly #knownRawPropertyIris: ReadonlySet = new Set(${ + JSON.stringify(getKnownPropertyIris(typeUri, types)) + }); + /** * Converts a JSON-LD structure to an object of this type. * @param json The JSON-LD structure to convert. @@ -554,6 +545,9 @@ export async function* generateDecoder( ...options, // @ts-ignore: an internal option _fromSubclass: true, + // The subclass retains the unknown properties, since only it knows all + // properties of the object: + _retainsRawProperties: false, }); if (!(instance instanceof ${type.name})) { throw new TypeError("Unexpected type: " + instance.constructor.name); @@ -671,6 +665,16 @@ export async function* generateDecoder( `; } yield ` + if ( + !("_retainsRawProperties" in options) || + options._retainsRawProperties !== false + ) { + const retained = retainRawProperties( + values, + ${type.name}.#knownRawPropertyIris, + ); + if (retained != null) retainedRawProperties.set(instance, retained); + } instance._shouldCacheJsonLd = shouldCacheJsonLd; if ( shouldCacheJsonLd && diff --git a/packages/vocab-tools/src/constructor.ts b/packages/vocab-tools/src/constructor.ts index 5d14e7eaf..5ab946a42 100644 --- a/packages/vocab-tools/src/constructor.ts +++ b/packages/vocab-tools/src/constructor.ts @@ -259,6 +259,10 @@ export async function* generateCloner( * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * + * Unknown properties retained when this instance was decoded are shared + * with the clone, so \`getRawPropertyValues()\` returns them for the clone + * as well, even if the clone replaces other values. + * * A clone never inherits a signed JSON-LD representation retained by * \`signObject()\`: the clone may differ from the document that the proof * covers, so embedding the original secured JSON in a parent document @@ -299,6 +303,7 @@ export async function* generateCloner( options ); copyPortableProvenance(this, clone); + copyRawProperties(this, clone); `; } else { yield `const clone = super.clone(values, options) as unknown as ${type.name};`; @@ -422,9 +427,10 @@ export async function* generateDeepCloner( * Each copied object retains its own default loaders, tracer, verifier * and base URL. Options override defaults only on the root instance. * This method does not fetch or serialize objects. Cached JSON-LD and - * retained signed representations are not copied; unknown JSON-LD - * properties and original formatting are not preserved. Sign the copy - * again if it needs a valid proof. + * retained signed representations are not copied, and original formatting + * is not preserved. Unknown properties retained when an object was decoded + * are shared with its copy, so \`getRawPropertyValues()\` returns them for + * the copy as well. Sign the copy again if it needs a valid proof. * * Trust and portable provenance follow clone() rules at every level. * Historical referrers within the graph are copied without replacements; diff --git a/packages/vocab-tools/src/property.ts b/packages/vocab-tools/src/property.ts index 4d2a9e7b7..ed858edef 100644 --- a/packages/vocab-tools/src/property.ts +++ b/packages/vocab-tools/src/property.ts @@ -31,13 +31,6 @@ async function* generateProperty( const override = emitOverride(type.uri, types, property); const trustOwner = type.trustEmbeddedObjects === false ? "null" : "this.id"; const doc = `\n/** ${property.description.replaceAll("\n", "\n * ")}\n */\n`; - const cachedPropertyBaseUrl = `(options as { baseUrl?: URL }).baseUrl ?? - this._baseUrl ?? - (this.id != null && - (this.id.protocol === "http:" || - this.id.protocol === "https:") - ? this.id - : undefined)`; if (areAllScalarTypes(property.range, types)) { if (hasSingularAccessor(property)) { yield doc; @@ -491,12 +484,27 @@ async function* generateProperty( const doc = Array.isArray(prop) ? prop[0] : prop; if (doc != null && typeof doc === "object" && "@context" in doc) { try { - v = await this.#${property.singularName}_fromJsonLd(doc, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: ${cachedPropertyBaseUrl}, - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + ${JSON.stringify(property.compactName)}, + ${ + JSON.stringify([ + property.uri, + ...(property.redundantProperties ?? []).map((p) => p.uri), + ]) + }, + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, doc, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( @@ -672,12 +680,27 @@ async function* generateProperty( const obj = Array.isArray(prop) ? prop[i] : prop; if (obj != null && typeof obj === "object" && "@context" in obj) { try { - v = await this.#${property.singularName}_fromJsonLd(obj, { - ...options, - // Keep the parent default for embedded objects. - verifyPortableObject: this._verifyPortableObject, - baseUrl: ${cachedPropertyBaseUrl}, - }); + const context = getCachedJsonLdContext( + this, + this._cachedJsonLd["@context"], + ); + if ( + await isCachedPropertyKey( + this._cachedJsonLd as Record, + context, + ${JSON.stringify(property.compactName)}, + ${ + JSON.stringify([ + property.uri, + ...(property.redundantProperties ?? []).map((p) => p.uri), + ]) + }, + options.contextLoader ?? this._contextLoader ?? + getDocumentLoader(), + ) + ) { + keepReceivedJsonLd(v, obj, context); + } } catch (error) { if (!options.suppressError) throw error; getLogger(["fedify", "vocab"]).debug( diff --git a/packages/vocab-tools/src/raw-property.ts b/packages/vocab-tools/src/raw-property.ts new file mode 100644 index 000000000..c681f1b30 --- /dev/null +++ b/packages/vocab-tools/src/raw-property.ts @@ -0,0 +1,439 @@ +import { getFieldName } from "./field.ts"; +import { + isNonFunctionalProperty, + type PropertySchema, + type TypeSchema, +} from "./schema.ts"; +import { areAllScalarTypes, getAllProperties, getEncoders } from "./type.ts"; + +/** + * Emits the body of a loop that encodes the values of a property into the + * shape that `toJsonLd({ format: "expand" })` passes to `jsonld.expand()`. + * The loop pushes encoded values into a local `array`, and expects the + * current value in `v` and the encoding options in `options`. + * @param property The property to encode. + * @param types The type schemas. + * @param signedValueScope The expression of the signed-value scope whose + * placeholders should replace retained signed values, + * or `undefined` to encode them as they are. + * @returns The code of the loop body. + */ +export function* generateExpandedPropertyElement( + property: PropertySchema, + types: Record, + signedValueScope?: string, +): Iterable { + yield ` + let element = ( + `; + const scalar = areAllScalarTypes(property.range, types); + if (!scalar) { + if (signedValueScope != null) { + yield `retainedSignedValueRef(v, ${signedValueScope}) ?? (`; + } + yield 'v instanceof URL ? { "@id": formatIri(v) } : '; + } + for (const code of getEncoders(property.range, types, "v", "options")) { + yield code; + } + if (!scalar && signedValueScope != null) yield ")"; + yield ` + ); + if (Array.isArray(element)) { + if (element.length < 1) continue; + if (element.length == 1) element = element[0]; + } + if (typeof element === "undefined") continue; + `; + if (isNonFunctionalProperty(property) && property.container === "graph") { + yield `array.push({ "@graph": element });`; + } else { + yield `array.push(element);`; + } +} + +/** + * Emits module-private support for the raw property functions, shared by all + * generated classes, and the public functions themselves. + */ +export function generateRawPropertyHelpers(): string { + return ` +type RawPropertyEncoder = ( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, +) => Promise; + +interface RawPropertyDescriptor { + readonly canonicalIri: string; + readonly encode: RawPropertyEncoder; +} + +// Unknown properties retained while decoding, keyed by the decoded object: +const retainedRawProperties = new WeakMap(); + +// Encoders of the properties each generated class declares, keyed by the +// class's prototype and then by the property IRIs, including aliases: +const rawPropertyDescriptors = new Map< + object, + ReadonlyMap +>(); + +function getRawPropertyDescriptor( + object: object, + iri: string, +): RawPropertyDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(object); + while (prototype != null) { + const descriptor = rawPropertyDescriptors.get(prototype)?.get(iri); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function copyRawProperties(source: object, destination: object): void { + const retained = retainedRawProperties.get(source); + if (retained == null) retainedRawProperties.delete(destination); + else retainedRawProperties.set(destination, retained); +} + +// The contexts in effect for the cached JSON-LD of embedded objects, which +// stays as it was received, keyed by the objects. Telling which keys of such +// a document are which properties takes the contexts of its parents as well: +const cachedJsonLdContexts = new WeakMap(); + +function getCachedJsonLdContext(object: object, context: unknown): unknown { + return cachedJsonLdContexts.has(object) + ? cachedJsonLdContexts.get(object) + : context; +} + +// Objects that were given the document they were received as: +const receivedJsonLd = new WeakSet(); + +// Gives an embedded object, decoded along with the whole document, the document +// it was received as, which toJsonLd() has to return as is, as a proof can +// cover it. The object is not decoded from that document, since an embedded +// document alone cannot rebuild what its parents' contexts contributed to it, +// such as type-scoped and property-scoped contexts: +function keepReceivedJsonLd( + object: unknown, + document: object, + parentContext: unknown, +): void { + if ( + object == null || typeof object !== "object" || + !(RAW_PROPERTY_PROTOCOL in object) || receivedJsonLd.has(object) + ) { + return; + } + receivedJsonLd.add(object); + (object as unknown as { _cachedJsonLd?: unknown })._cachedJsonLd = + structuredClone(document); + const own = (document as { "@context"?: unknown })["@context"]; + cachedJsonLdContexts.set(object, [ + ...(globalThis.Array.isArray(parentContext) + ? parentContext + : [parentContext]), + ...(globalThis.Array.isArray(own) ? own : [own]), + ]); +} + +// The results of isCachedPropertyKey(), keyed by the document and then by the +// key: +const cachedPropertyKeys = new WeakMap>>(); + +async function expandTopLevelKeys( + document: Record, + contextLoader: DocumentLoader, +): Promise { + const expanded = await jsonld.expand(document, { + documentLoader: contextLoader, + keepFreeFloatingNodes: true, + }); + return globalThis.Object.keys(expanded[0] ?? {}).filter((iri) => + !iri.startsWith("@") + ); +} + +// The number of expansions must not depend on the document, which can come +// from a remote peer, as each of them can load the contexts again: +async function mapsOnlyKeyToProperty( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + const own = await expandTopLevelKeys( + { "@context": context, [key]: [] }, + contextLoader, + ); + if (own.length !== 1 || own[0] !== iris[0]) return false; + // Only the keys matter, so nested values and their contexts are left out, + // while scalars stay for keyword aliases such as id, which require them: + const others: Record = { "@context": context }; + for (const [k, value] of globalThis.Object.entries(document)) { + if (k === key || k.startsWith("@")) continue; + others[k] = value != null && typeof value === "object" ? [] : value; + } + try { + const expanded = await expandTopLevelKeys(others, contextLoader); + return !expanded.some((iri) => iris.includes(iri)); + } catch { + // Some other term could not take the placeholder, so nothing is known: + return false; + } +} + +// Whether the embedded documents under a key of a compacted document are the +// values decoded for a property. The document has to map the key, and no other +// key, to the property, as a context can remap the key or map another term to +// the property, in which case the cached documents cannot be matched with the +// decoded values: +async function isCachedPropertyKey( + document: Record, + context: unknown, + key: string, + iris: readonly string[], + contextLoader: DocumentLoader, +): Promise { + let checks = cachedPropertyKeys.get(document); + if (checks == null) { + checks = new Map(); + cachedPropertyKeys.set(document, checks); + } + const cached = checks.get(key); + if (cached != null) return await cached; + const check = mapsOnlyKeyToProperty( + document, + context, + key, + iris, + contextLoader, + ); + // A failure, such as of the context loader, is not remembered, as another + // call can pass another loader: + const map = checks; + check.catch(() => map.delete(key)); + checks.set(key, check); + return await check; +} + +async function readRawProperty( + object: object, + request: RawPropertyRequest, + contextLoader: DocumentLoader, +): Promise { + const retained = retainedRawProperties.get(object); + for (const iri of request.candidates) { + const descriptor = getRawPropertyDescriptor(object, iri); + if (descriptor != null) { + const value = await descriptor.encode( + object, + createRawPropertyEncodingOptions(request.stack, contextLoader), + ); + return value === undefined ? [] : await expandRawPropertyValue( + descriptor.canonicalIri, + value, + contextLoader, + ); + } + if (retained != null && globalThis.Object.hasOwn(retained, iri)) { + return retained[iri]; + } + } + return []; +} + +/** + * Gets the values of a property of a vocabulary object in expanded JSON-LD, + * looking the property up by its full IRI. This works for properties that + * have no typed accessor as well as for those that do. + * + * *Raw* means untyped expanded JSON-LD values, such as + * \`{ "@value": "Hello" }\` or \`{ "@id": "https://example.com/" }\`, as + * opposed to the values that typed accessors return. It does not mean the + * received document: + * + * - For a property that the object's class has no accessor for, the result + * is the values retained when the object was decoded by \`fromJsonLd()\`. + * Objects constructed locally have none. + * - For a property that the class has an accessor for, including a + * redundant alias of such a property, the result is the current typed + * values encoded back into expanded JSON-LD. It reflects \`clone()\` + * replacements and objects fetched by dereferencing accessors, and it can + * differ from the received values: for example, values that failed to + * decode are missing, and lexical forms such as date-times are + * normalized. When a later release adds an accessor for a property, + * the result for that property switches from the retained values to the + * encoded ones. + * + * The values are not verified in any way, and IRIs in them are never + * dereferenced. Validate them before use, as with any other data received + * from a remote server. The result is a deep copy, so modifying it does not + * affect the object. + * + * The IRI is matched as given, and then as normalized by the WHATWG URL + * parser. Prefixes are never expanded: \`"as:content"\` is a valid IRI with + * the \`as:\` scheme, so it normally matches nothing. An IRI whose scheme is + * not \`http:\` or \`https:\` is therefore logged as a warning under the + * \`["fedify", "vocab"]\` category. + * + * \`\`\`typescript ignore + * const values = await getRawPropertyValues( + * note, + * "https://w3id.org/quantpub#structuredUrl", + * ); + * for (const value of values) { + * if ("@id" in value && typeof value["@id"] === "string") { + * console.log(new URL(value["@id"])); + * } + * } + * \`\`\` + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The values of the property, or an empty array if it has none. + * @throws {TypeError} If \`propertyIri\` is not an absolute IRI, e.g., an + * empty string, a JSON-LD keyword such as \`"@id"\`, a + * blank node identifier, a term, or a relative + * reference; if \`object\` is not a generated vocabulary + * object; or if encoding the values of a known property + * meets a cycle of objects. + * @since 2.5.0 + */ +export function getRawPropertyValues( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + return readRawPropertyValues(object, propertyIri, "getRawPropertyValues"); +} + +/** + * Gets the first value of a property of a vocabulary object in expanded + * JSON-LD, looking the property up by its full IRI. It is equivalent to + * \`(await getRawPropertyValues(object, propertyIri))[0] ?? null\`; see + * {@link getRawPropertyValues} for how the values are obtained. + * + * It does not throw when the property has multiple values. JSON-LD does not + * order the values of a property unless it is a list, so the first value is + * not more significant than the others. A list property has a single value, + * the \`{ "@list": [...] }\` object. + * + * @param object The vocabulary object to read. It can be an object of any + * module generated by \`@fedify/vocab-tools\`. + * @param propertyIri The full IRI of the property. + * @returns The first value of the property, or \`null\` if it has none. + * @throws {TypeError} In the same cases as {@link getRawPropertyValues}. + * @since 2.5.0 + */ +export async function getRawPropertyValue( + object: VocabularyObject, + propertyIri: string | URL, +): Promise { + const values = await readRawPropertyValues( + object, + propertyIri, + "getRawPropertyValue", + ); + return values[0] ?? null; +} +`; +} + +/** + * Collects the full IRIs of the properties that the given class decodes, + * including inherited properties and redundant aliases. + */ +export function getKnownPropertyIris( + typeUri: string, + types: Record, +): string[] { + const iris = new Set(); + for (const property of getAllProperties(typeUri, types)) { + iris.add(property.uri); + if (property.redundantProperties != null) { + for (const alias of property.redundantProperties) iris.add(alias.uri); + } + } + return [...iris].sort(); +} + +/** + * Emits a static block that registers the encoders of the properties the + * given class declares, keeping them and their private-field access out of + * the declaration files. A root class also installs the method through which + * the raw property functions reach these encoders and the retained unknown + * properties. + */ +export async function* generateRawPropertyDescriptors( + typeUri: string, + types: Record, +): AsyncIterable { + const type = types[typeUri]; + if (type.extends != null && type.properties.length < 1) return; + yield "static {\n"; + if (type.extends == null) { + yield ` + globalThis.Object.defineProperty(this.prototype, RAW_PROPERTY_PROTOCOL, { + value: function ( + this: ${type.name}, + request: RawPropertyRequest, + ): Promise { + return readRawProperty( + this, + request, + this.#contextLoader ?? getDocumentLoader(), + ); + }, + configurable: true, + enumerable: false, + writable: true, + }); + `; + } + if (type.properties.length > 0) { + yield ` + const descriptors = new Map(); + let descriptor: RawPropertyDescriptor; + `; + } + for (const property of type.properties) { + yield ` + descriptor = { + canonicalIri: ${JSON.stringify(property.uri)}, + // Scalar encoders are mostly synchronous, but some are not: + // deno-lint-ignore require-await + async encode( + object: object, + options: { format: "expand"; contextLoader?: DocumentLoader }, + ): Promise { + const array: unknown[] = []; + for (const v of (object as ${type.name}).${await getFieldName( + property.uri, + )}) { + `; + yield* generateExpandedPropertyElement(property, types); + yield ` + } + if (array.length < 1) return undefined; + return ${ + isNonFunctionalProperty(property) && property.container === "list" + ? `{ "@list": array }` + : "array" + }; + }, + }; + descriptors.set(${JSON.stringify(property.uri)}, descriptor); + `; + for (const alias of property.redundantProperties ?? []) { + yield `descriptors.set(${JSON.stringify(alias.uri)}, descriptor);\n`; + } + } + if (type.properties.length > 0) { + yield "rawPropertyDescriptors.set(this.prototype, descriptors);\n"; + } + yield "}\n"; +} diff --git a/packages/vocab-tools/src/type.ts b/packages/vocab-tools/src/type.ts index 5e39b0807..500ff85b0 100644 --- a/packages/vocab-tools/src/type.ts +++ b/packages/vocab-tools/src/type.ts @@ -622,7 +622,11 @@ export function getEncoder( format: undefined, context: undefined, })` - : `await ${variable}.toJsonLd(${optionsVariable})`; + : `await encodeNestedVocabularyValue( + ${optionsVariable}, + ${variable}, + () => ${variable}.toJsonLd(${optionsVariable}), + )`; } throw new Error(`Unknown type: ${typeUri}`); } @@ -677,9 +681,16 @@ export function getDecoder( ); } if (typeUri in types) { + // An embedded value is another object, which retains its own unknown + // properties even when it is decoded by a superclass of its parent: return `await ${types[typeUri].name}.fromJsonLd( ${variable}, - { ...${optionsVariable}, baseUrl: ${baseUrlVariable} } + { + ...${optionsVariable}, + baseUrl: ${baseUrlVariable}, + // @ts-ignore: an internal option + _retainsRawProperties: true, + } )`; } throw new Error(`Unknown type: ${typeUri}`); diff --git a/packages/vocab/src/mod.ts b/packages/vocab/src/mod.ts index f30b7b148..0a6e270df 100644 --- a/packages/vocab/src/mod.ts +++ b/packages/vocab/src/mod.ts @@ -69,5 +69,10 @@ export type { PortableObjectVerifierOptions, PropertyPreprocessor, PropertyPreprocessorContext, + RawListObject, + RawNodeObject, + RawPropertyValue, + RawValueObject, RemoteDocument, + VocabularyObject, } from "@fedify/vocab-runtime"; diff --git a/packages/vocab/src/raw-property.test.ts b/packages/vocab/src/raw-property.test.ts new file mode 100644 index 000000000..1c06687e3 --- /dev/null +++ b/packages/vocab/src/raw-property.test.ts @@ -0,0 +1,760 @@ +import { mockDocumentLoader, test } from "@fedify/fixture"; +import { LanguageString } from "@fedify/vocab-runtime"; +import { configure, type LogRecord, reset } from "@logtape/logtape"; +import { deepStrictEqual, ok, rejects, strictEqual } from "node:assert/strict"; +import { + Create, + getRawPropertyValue, + getRawPropertyValues, + Note, + Object as ASObject, + Person, + Question, +} from "./mod.ts"; + +const AS = "https://www.w3.org/ns/activitystreams"; +const QUANT = "https://w3id.org/quantpub#"; +const STRUCTURED_URL = `${QUANT}structuredUrl`; + +const structuredNote = { + "@context": [AS, { quant: QUANT }], + id: "https://example.com/notes/1", + type: "Note", + content: "Hello", + "quant:structuredUrl": { "@id": "https://example.com/data/1?token=abc" }, +}; + +test("getRawPropertyValues() reads an unknown property", async () => { + const note = await Note.fromJsonLd(structuredNote); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1?token=abc" }, + ]); + deepStrictEqual( + await getRawPropertyValues(note, new URL(STRUCTURED_URL)), + [{ "@id": "https://example.com/data/1?token=abc" }], + ); + deepStrictEqual(await getRawPropertyValues(note, `${QUANT}missing`), []); + deepStrictEqual(await getRawPropertyValue(note, STRUCTURED_URL), { + "@id": "https://example.com/data/1?token=abc", + }); + strictEqual(await getRawPropertyValue(note, `${QUANT}missing`), null); +}); + +test("getRawPropertyValues() is independent of prefixes", async () => { + const note = await Note.fromJsonLd({ + "@context": [AS, { q: QUANT, url2: `${QUANT}structuredUrl` }], + type: "Note", + "q:structuredUrl": { "@id": "https://example.com/a" }, + url2: { "@id": "https://example.com/b" }, + }); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "https://example.com/a" }, + { "@id": "https://example.com/b" }, + ]); +}); + +test("getRawPropertyValues() reads literals, lists, and JSON", async () => { + const note = await Note.fromJsonLd({ + "@context": [ + AS, + { + quant: QUANT, + "quant:series": { "@container": "@list" }, + "quant:payload": { "@type": "@json" }, + }, + ], + type: "Note", + "quant:label": [{ "@value": "One", "@language": "en" }, "Two", 3], + "quant:series": [1, 2], + "quant:payload": { nested: { value: [true, null] } }, + }); + deepStrictEqual(await getRawPropertyValues(note, `${QUANT}label`), [ + { "@value": "One", "@language": "en" }, + { "@value": "Two" }, + { "@value": 3 }, + ]); + deepStrictEqual(await getRawPropertyValues(note, `${QUANT}series`), [ + { "@list": [{ "@value": 1 }, { "@value": 2 }] }, + ]); + deepStrictEqual(await getRawPropertyValue(note, `${QUANT}series`), { + "@list": [{ "@value": 1 }, { "@value": 2 }], + }); + deepStrictEqual(await getRawPropertyValues(note, `${QUANT}payload`), [ + { "@type": "@json", "@value": { nested: { value: [true, null] } } }, + ]); +}); + +test("getRawPropertyValues() returns deep copies", async () => { + const note = await Note.fromJsonLd({ + "@context": [AS, { quant: QUANT, "quant:payload": { "@type": "@json" } }], + type: "Note", + "quant:payload": { list: [1] }, + }); + const values = await getRawPropertyValues(note, `${QUANT}payload`); + (values[0] as { "@value": { list: number[] } })["@value"].list.push(2); + values.push({ "@value": "extra" }); + deepStrictEqual(await getRawPropertyValues(note, `${QUANT}payload`), [ + { "@type": "@json", "@value": { list: [1] } }, + ]); +}); + +test("getRawPropertyValues() reads embedded objects", async () => { + // The embedded note relies on the parent's context only: + const create = await Create.fromJsonLd({ + "@context": [AS, { quant: QUANT }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + id: "https://example.com/notes/1", + type: "Note", + "quant:structuredUrl": { "@id": "https://example.com/data/1" }, + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); + const notes = await Array.fromAsync(create.getObjects()); + deepStrictEqual(await getRawPropertyValues(notes[0], STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); +}); + +test("getRawPropertyValues() reads embedded objects with their own contexts", async () => { + // The prefix comes from the parent, while the embedded note has its own + // context, so the accessors find it in the cached JSON-LD: + const create = await Create.fromJsonLd({ + "@context": [AS, { quant: QUANT }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + "quant:structuredUrl": { "@id": "https://example.com/data/1" }, + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); + const notes = await Array.fromAsync(create.getObjects()); + deepStrictEqual(await getRawPropertyValues(notes[0], STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); +}); + +test("getRawPropertyValues() reads objects nested in cached embedded objects", async () => { + const create = await Create.fromJsonLd({ + "@context": [AS, { quant: QUANT }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + attachment: { + type: "Document", + "quant:structuredUrl": { "@id": "https://example.com/data/2" }, + }, + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + const [attachment] = await Array.fromAsync(note.getAttachments()); + ok(attachment != null); + deepStrictEqual(await getRawPropertyValues(attachment, STRUCTURED_URL), [ + { "@id": "https://example.com/data/2" }, + ]); +}); + +test("getRawPropertyValues() reads embedded objects that rely on the parent's context", async () => { + // Only the outer context defines these terms, and the embedded objects + // have their own contexts, so accessors decode them from the cache again: + const create = await Create.fromJsonLd({ + "@context": [AS, { + Doc: `${AS}#Document`, + Poll: `${AS}#Question`, + choices: `${AS}#oneOf`, + quant: QUANT, + }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/questions/1", + type: ["Poll", "Object"], + choices: [{ type: "Note", name: "Yes" }], + "quant:structuredUrl": { "@id": "https://example.com/data/1" }, + attachment: [ + { + type: "Doc", + "quant:structuredUrl": { "@id": "https://example.com/data/a" }, + }, + { + type: "Document", + "quant:structuredUrl": { "@id": "https://example.com/data/b" }, + }, + ], + }, + }); + const question = await create.getObject(); + ok(question instanceof Question); + deepStrictEqual( + (await Array.fromAsync(question.getExclusiveOptions())).map((o) => + o.name?.toString() + ), + ["Yes"], + ); + deepStrictEqual(await getRawPropertyValues(question, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); + const attachments = await Array.fromAsync(question.getAttachments()); + deepStrictEqual(attachments.length, 2); + for (const [i, attachment] of attachments.entries()) { + ok(attachment != null); + deepStrictEqual(await getRawPropertyValues(attachment, STRUCTURED_URL), [ + { "@id": `https://example.com/data/${"ab"[i]}` }, + ]); + } +}); + +test("embedded objects keep the order of the parent's context", async () => { + const create = await Create.fromJsonLd({ + // The second entry refers to a term the first one defines: + "@context": [AS, { Alias: "Note", quant: QUANT }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Alias", + content: "Hello", + "quant:structuredUrl": { "@id": "https://example.com/data/1" }, + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); +}); + +test("embedded objects do not inherit non-propagating contexts", async () => { + const create = await Create.fromJsonLd({ + // Only the first entry of a context can declare this: + "@context": [{ "@propagate": false, body: `${AS}#content` }, AS], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + // The term is out of scope here, so this is not the content: + body: "Not the content", + content: "Hello", + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(note.contents, ["Hello"]); +}); + +test("embedded objects keep their own non-propagating contexts", async () => { + const create = await Create.fromJsonLd({ + "@context": AS, + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": [{ "@propagate": false, body: `${AS}#content` }, AS], + id: "https://example.com/notes/1", + type: "Note", + attachment: { + "@context": AS, + type: "Document", + // The term is out of scope here, so this is not the content: + body: "Not the content", + content: "Hello", + }, + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + const [attachment] = await Array.fromAsync(note.getAttachments()); + ok(attachment instanceof ASObject); + deepStrictEqual(attachment.contents, ["Hello"]); +}); + +test("embedded objects keep their cached JSON-LD as received", async () => { + const context = [AS, "https://w3id.org/security/data-integrity/v1"]; + const object = { + "@context": context, + id: "https://example.com/notes/1", + type: "Alias", + content: "Hello", + attachment: { + "@context": AS, + type: "Doc", + "quant:structuredUrl": { "@id": "https://example.com/data/1" }, + }, + }; + const create = await Create.fromJsonLd({ + "@context": [AS, { + Alias: `${AS}#Note`, + Doc: `${AS}#Document`, + quant: QUANT, + }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object, + }); + const note = await create.getObject(); + ok(note instanceof Note); + // A proof can cover the context, so it has to stay as it was received: + deepStrictEqual(await note.toJsonLd(), object); + // Objects nested in it still get the context of the outermost document: + const [attachment] = await Array.fromAsync(note.getAttachments()); + ok(attachment != null); + deepStrictEqual(await getRawPropertyValues(attachment, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); +}); + +test("embedded portable objects keep their own contexts in the cache", async () => { + const did = "did:key:z6Mkpbx26hCxv3hr2gEz8iCm6SykyBU7wXPa3tTceF2fiFVr"; + const create = await Create.fromJsonLd({ + "@context": [AS, { Alias: `${AS}#Note` }], + id: `ap://${did}/activities/1`, + type: "Create", + actor: `ap://${did}/actor`, + object: { + "@context": AS, + id: `ap://${did}/objects/1`, + type: "Alias", + attributedTo: `ap://${did}/actor`, + content: "Hello", + }, + }); + const note = await create.getObject({ + verifyPortableObject: () => Promise.resolve({ verified: true }), + }); + ok(note instanceof Note); + const jsonLd = await note.toJsonLd() as Record; + deepStrictEqual(jsonLd["@context"], AS); + strictEqual(jsonLd.content, "Hello"); +}); + +test("accessors do not load contexts once per field of a cached document", async () => { + const context = "https://example.com/contexts/extension"; + let loads = 0; + const contextLoader = (url: string) => { + if (url !== context) return mockDocumentLoader(url); + loads++; + return Promise.resolve({ + contextUrl: null, + documentUrl: url, + document: { "@context": { ext: "https://example.com/ns#" } }, + }); + }; + const create = await Create.fromJsonLd({ + "@context": [AS, context], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + ...Object.fromEntries( + Array.from({ length: 100 }, (_, i) => [`ext:field${i}`, i]), + ), + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + content: "Hello", + }, + }, { contextLoader }); + loads = 0; + const note = await create.getObject({ contextLoader }); + ok(note instanceof Note); + ok(loads <= 5, `Loaded the context ${loads} times.`); +}); + +test("embedded objects keep their received JSON-LD on the fallback path", async () => { + const object = { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + content: "Hello", + // A signature can cover a property that typed values cannot rebuild: + [STRUCTURED_URL]: { "@id": "https://example.com/data/1" }, + }; + for ( + const context of [ + [AS, { object: { "@id": `${AS}#object`, "@context": {} } }], + [{ "@propagate": false, body: `${AS}#content` }, AS], + ] + ) { + const create = await Create.fromJsonLd({ + "@context": context, + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(await note.toJsonLd(), object); + } +}); + +test("accessors do not load contexts once per embedded object", async () => { + const context = "https://example.com/contexts/extension"; + let loads = 0; + const contextLoader = (url: string) => { + if (url !== context) return mockDocumentLoader(url); + loads++; + return Promise.resolve({ + contextUrl: null, + documentUrl: url, + document: { "@context": { ext: "https://example.com/ns#" } }, + }); + }; + const note = await Note.fromJsonLd({ + "@context": [AS, context], + id: "https://example.com/notes/1", + type: "Note", + attachment: Array.from({ length: 50 }, (_, i) => ({ + "@context": AS, + type: "Document", + name: `Attachment ${i}`, + })), + }, { contextLoader }); + loads = 0; + const attachments = await Array.fromAsync( + note.getAttachments({ contextLoader }), + ); + strictEqual(attachments.length, 50); + ok(loads <= 5, `Loaded the context ${loads} times.`); +}); + +test("embedded objects keep values under type-scoped contexts", async () => { + const create = await Create.fromJsonLd({ + "@context": [AS, { + body: `${AS}#content`, + Create: { + "@id": `${AS}#Create`, + "@context": { "@propagate": true, body: null }, + }, + }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + // The type-scoped context of the parent removes this term: + body: "Not the content", + content: "Hello", + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(note.contents, ["Hello"]); +}); + +test("embedded objects keep values under property-scoped contexts", async () => { + const create = await Create.fromJsonLd({ + "@context": [AS, { + body: `${AS}#content`, + object: { "@id": `${AS}#object`, "@context": { body: null } }, + }], + id: "https://example.com/activities/1", + type: "Create", + actor: "https://example.com/users/alice", + object: { + "@context": AS, + id: "https://example.com/notes/1", + type: "Note", + // The property-scoped context of the parent removes this term: + body: "Not the content", + content: "Hello", + }, + }); + const note = await create.getObject(); + ok(note instanceof Note); + deepStrictEqual(note.contents, ["Hello"]); +}); + +test("getRawPropertyValues() reads embedded objects under terms of the parent's context", async () => { + const note = await Note.fromJsonLd({ + "@context": [AS, { extra: `${AS}#attachment`, attachment: null }], + id: "https://example.com/notes/1", + type: "Note", + // The outer context ignores this term and maps another to as:attachment, + // so the cached documents under the default term are not the values: + attachment: [ + { + "@context": AS, + type: "Document", + name: "Ignored", + [STRUCTURED_URL]: { "@id": "https://example.com/data/0" }, + }, + ], + extra: [ + { + "@context": AS, + type: "Document", + name: "First", + [STRUCTURED_URL]: { "@id": "https://example.com/data/1" }, + }, + { + "@context": AS, + type: "Document", + name: "Second", + [STRUCTURED_URL]: { "@id": "https://example.com/data/2" }, + }, + ], + }); + const attachments = await Array.fromAsync(note.getAttachments()); + deepStrictEqual(attachments.map((a) => a?.name?.toString()), [ + "First", + "Second", + ]); + for (const [i, attachment] of attachments.entries()) { + ok(attachment != null); + deepStrictEqual(await getRawPropertyValues(attachment, STRUCTURED_URL), [ + { "@id": `https://example.com/data/${i + 1}` }, + ]); + } +}); + +test("getRawPropertyValues() keeps unknown properties across copies", async () => { + const note = await Note.fromJsonLd(structuredNote); + const expected = [{ "@id": "https://example.com/data/1?token=abc" }]; + const clone = note.clone({ content: "Edited" }); + deepStrictEqual(await getRawPropertyValues(clone, STRUCTURED_URL), expected); + deepStrictEqual( + await getRawPropertyValues(note.deepClone(), STRUCTURED_URL), + expected, + ); + const reparsed = await Note.fromJsonLd(await note.toJsonLd()); + deepStrictEqual( + await getRawPropertyValues(reparsed, STRUCTURED_URL), + expected, + ); + const expanded = await Note.fromJsonLd( + await clone.toJsonLd({ format: "expand" }), + ); + // Serializing from typed values does not emit unknown properties: + deepStrictEqual(await getRawPropertyValues(expanded, STRUCTURED_URL), []); + deepStrictEqual( + await getRawPropertyValues(new Note({ content: "Hi" }), STRUCTURED_URL), + [], + ); +}); + +test("getRawPropertyValues() keeps unknown properties of partly invalid objects", async () => { + const note = await Note.fromJsonLd({ + ...structuredNote, + // Neither an Image nor a Link, so it is skipped: + icon: 123, + }); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1?token=abc" }, + ]); +}); + +test("getRawPropertyValues() encodes known properties", async () => { + const note = await Note.fromJsonLd(structuredNote); + deepStrictEqual(await getRawPropertyValues(note, `${AS}#content`), [ + { "@value": "Hello" }, + ]); + const clone = note.clone({ + contents: ["Edited", new LanguageString("Modifié", "fr")], + attribution: new URL("https://example.com/users/alice"), + }); + deepStrictEqual(await getRawPropertyValues(clone, `${AS}#content`), [ + { "@value": "Edited" }, + { "@value": "Modifié", "@language": "fr" }, + ]); + deepStrictEqual(await getRawPropertyValues(clone, `${AS}#attributedTo`), [ + { "@id": "https://example.com/users/alice" }, + ]); + deepStrictEqual(await getRawPropertyValues(clone, `${AS}#name`), []); +}); + +test("getRawPropertyValues() encodes known object properties", async () => { + const create = new Create({ + id: new URL("https://example.com/activities/1"), + object: new Note({ + id: new URL("https://example.com/notes/1"), + content: "Hello", + }), + }); + deepStrictEqual(await getRawPropertyValues(create, `${AS}#object`), [ + { + "@id": "https://example.com/notes/1", + "@type": [`${AS}#Note`], + [`${AS}#content`]: [{ "@value": "Hello" }], + }, + ]); + const question = new Question({ + exclusiveOptions: [new Note({ name: "A" }), new Note({ name: "B" })], + }); + deepStrictEqual(await getRawPropertyValues(question, `${AS}#oneOf`), [ + { "@type": [`${AS}#Note`], [`${AS}#name`]: [{ "@value": "A" }] }, + { "@type": [`${AS}#Note`], [`${AS}#name`]: [{ "@value": "B" }] }, + ]); +}); + +test("getRawPropertyValues() maps redundant aliases to canonical properties", async () => { + // dcterms:license is written canonically, so the alias is never emitted: + const note = await Note.fromJsonLd({ + "@context": [AS, { schema: "https://schema.org/" }], + type: "Note", + "schema:license": { "@id": "https://creativecommons.org/licenses/by/4.0/" }, + }); + const expected = [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }]; + deepStrictEqual( + await getRawPropertyValues(note, "https://schema.org/license"), + expected, + ); + deepStrictEqual( + await getRawPropertyValues(note, "http://purl.org/dc/terms/license"), + expected, + ); +}); + +test("getRawPropertyValues() classifies properties by the concrete class", async () => { + // A Person does not have Question's oneOf property, so it is retained: + const person = await Person.fromJsonLd({ + "@context": AS, + type: "Person", + oneOf: { type: "Note", name: "A" }, + }); + deepStrictEqual(await getRawPropertyValues(person, `${AS}#oneOf`), [ + { "@type": [`${AS}#Note`], [`${AS}#name`]: [{ "@value": "A" }] }, + ]); + const object = await ASObject.fromJsonLd({ + "@context": [AS, { quant: QUANT }], + type: "Note", + "quant:structuredUrl": { "@id": "https://example.com/data/1" }, + }); + ok(object instanceof Note); + deepStrictEqual(await getRawPropertyValues(object, STRUCTURED_URL), [ + { "@id": "https://example.com/data/1" }, + ]); +}); + +test("getRawPropertyValues() does not resolve relative IRIs of unknown properties", async () => { + // Expansion cannot tell which properties hold IRIs that may be resolved, + // e.g., fedify:absoluteIri values are never resolved, so it gets no base: + const note = await Note.fromJsonLd({ + "@context": [AS, { quant: QUANT }], + type: "Note", + "quant:structuredUrl": { "@id": "data/1" }, + }, { baseUrl: new URL("https://example.com/notes/") }); + deepStrictEqual(await getRawPropertyValues(note, STRUCTURED_URL), [ + { "@id": "data/1" }, + ]); +}); + +test("getRawPropertyValues() matches normalized IRIs", async () => { + const note = await Note.fromJsonLd(structuredNote); + deepStrictEqual( + await getRawPropertyValues(note, "HTTPS://W3ID.org/quantpub#structuredUrl"), + [{ "@id": "https://example.com/data/1?token=abc" }], + ); + deepStrictEqual( + await getRawPropertyValues( + note, + "HTTPS://www.w3.org/ns/activitystreams#content", + ), + [{ "@value": "Hello" }], + ); +}); + +test("getRawPropertyValues() rejects invalid property IRIs", async () => { + const note = await Note.fromJsonLd(structuredNote); + for ( + const iri of [ + "", + "@id", + "@type", + "_:b0", + "content", + "/content", + "#content", + "https://example.com/a b", + "https://example.com/%zz", + "https://example.com/#a#b", + ] + ) { + await rejects(() => getRawPropertyValues(note, iri), TypeError, iri); + } + await rejects( + () => getRawPropertyValues(note, 123 as unknown as string), + TypeError, + ); + await rejects( + () => + getRawPropertyValues( + { + "~fedify.vocab": true, + id: null, + toJsonLd: () => Promise.resolve({}), + }, + STRUCTURED_URL, + ), + TypeError, + ); +}); + +test("getRawPropertyValues() warns about compact IRIs", async () => { + const records: LogRecord[] = []; + await configure({ + sinks: { buffer: (record: LogRecord) => records.push(record) }, + loggers: [ + { category: ["fedify", "vocab"], sinks: ["buffer"] }, + { category: ["logtape", "meta"], sinks: [] }, + ], + reset: true, + }); + try { + const note = await Note.fromJsonLd(structuredNote); + deepStrictEqual(await getRawPropertyValues(note, "as:summary"), []); + deepStrictEqual(await getRawPropertyValues(note, "as:summary"), []); + deepStrictEqual( + await getRawPropertyValues(note, "urn:example:property"), + [], + ); + deepStrictEqual( + await getRawPropertyValues(note, "https://example.com/property"), + [], + ); + strictEqual(records.length, 2); + strictEqual(records[0].level, "warning"); + deepStrictEqual(records[0].properties, { + iri: "as:summary", + scheme: "as", + function: "getRawPropertyValues", + suggestion: `${AS}#summary`, + }); + deepStrictEqual(records[1].properties, { + iri: "urn:example:property", + scheme: "urn", + function: "getRawPropertyValues", + }); + } finally { + await reset(); + } +}); diff --git a/packages/vocab/src/vocab.test.ts b/packages/vocab/src/vocab.test.ts index a03840fd4..f1b263da6 100644 --- a/packages/vocab/src/vocab.test.ts +++ b/packages/vocab/src/vocab.test.ts @@ -2234,66 +2234,16 @@ test({ function embeddedPropertyDocument(property: "attachment" | "object") { const context = "https://www.w3.org/ns/activitystreams"; return { - "@context": [context, { CustomImage: `${context}#Image` }], + "@context": context, type: property === "attachment" ? "Note" : "Create", [property]: [ - { - "@context": [context, { "@vocab": "https://example.com/" }], - type: "CustomImage", - name: "Malformed when reparsed", - }, { "@context": context, type: "Image", name: "Cached image" }, + { "@context": context, type: "Image", name: "Other cached image" }, { type: "Image", name: "Decoded image" }, ], }; } -for (const suppressError of [undefined, false, true]) { - test( - `Note.getAttachments() cached parse failure (suppressError: ${suppressError})`, - async () => { - const jsonLd = embeddedPropertyDocument("attachment"); - const note = await Note.fromJsonLd(jsonLd); - if (suppressError) { - for (let i = 0; i < 2; i++) { - const attachments: (Object | Link | PropertyValue)[] = await Array - .fromAsync( - note.getAttachments({ suppressError }), - ); - deepStrictEqual( - attachments.map((attachment) => attachment.name), - ["Cached image", "Decoded image"], - ); - } - // Suppression must not remove or replace the cached malformed value. - await rejects(() => Array.fromAsync(note.getAttachments()), TypeError); - } else { - await rejects( - () => Array.fromAsync(note.getAttachments({ suppressError })), - TypeError, - ); - } - deepStrictEqual(await note.toJsonLd(), jsonLd); - }, - ); - - test( - `Activity.getObject() cached parse failure (suppressError: ${suppressError})`, - async () => { - const jsonLd = embeddedPropertyDocument("object"); - const activity = await Activity.fromJsonLd(jsonLd); - if (suppressError) { - deepStrictEqual(await activity.getObject({ suppressError }), null); - deepStrictEqual(await activity.getObject({ suppressError }), null); - await rejects(() => activity.getObject(), TypeError); - } else { - await rejects(() => activity.getObject({ suppressError }), TypeError); - } - deepStrictEqual(await activity.toJsonLd(), jsonLd); - }, - ); -} - test("Note.getAttachments() suppresses cached context loader failures", async () => { const note = await Note.fromJsonLd(embeddedPropertyDocument("attachment")); const contextLoader = () =>