Unverified Commit 1e62d986 authored by Hong Minhee's avatar Hong Minhee
Browse files

Merge tag '1.0.15' into 1.1-maintenance

Fedify 1.0.15
parents ec1997b9 8dcaaa5b
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -8,6 +8,13 @@ Version 1.1.12

To be released.

 -  Fixed a bug with nested object hydration in Activity Vocabulary API where
    deeply nested properties (like `Object.getAttribution()` on
    `Activity.getObject()`) were't being properly hydrated during `toJsonLd()`
    calls. Previously, subsequent calls to `toJsonLd()` on nested objects could
    result in inconsistent JSON-LD output where nested objects remained as URLs
    instead of being fully expanded.


Version 1.1.11
--------------
@@ -297,6 +304,19 @@ Released on October 20, 2024.
[#150]: https://github.com/dahlia/fedify/issues/150


Version 1.0.15
--------------

Released on February 10, 2025.

 -  Fixed a bug with nested object hydration in Activity Vocabulary API where
    deeply nested properties (like `Object.getAttribution()` on
    `Activity.getObject()`) were't being properly hydrated during `toJsonLd()`
    calls. Previously, subsequent calls to `toJsonLd()` on nested objects could
    result in inconsistent JSON-LD output where nested objects remained as URLs
    instead of being fully expanded.


Version 1.0.14
--------------

+426 −330

File changed.

Preview size limit exceeded, changes collapsed.

+9 −2
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ async function* generateClass(
    yield `
    readonly #documentLoader?: DocumentLoader;
    readonly #contextLoader?: DocumentLoader;
    #cachedJsonLd?: unknown;
    readonly id: URL | null;

    protected get _documentLoader(): DocumentLoader | undefined {
@@ -59,11 +60,17 @@ async function* generateClass(
    protected get _contextLoader(): DocumentLoader | undefined {
      return this.#contextLoader;
    }

    protected get _cachedJsonLd(): unknown | undefined {
      return this.#cachedJsonLd;
    }

    protected set _cachedJsonLd(value: unknown | undefined) {
      this.#cachedJsonLd = value;
    }
    `;
  }
  yield `
    #cachedJsonLd?: unknown;

    /**
     * The type URI of {@link ${type.name}}: \`${typeUri}\`.
     */
+3 −3
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ export async function* generateEncoder(
    contextLoader?: DocumentLoader,
    context?: string | Record<string, string> | (string | Record<string, string>)[],
  } = {}): Promise<unknown> {
    if (options.format == null && this.#cachedJsonLd != null) {
      return this.#cachedJsonLd;
    if (options.format == null && this._cachedJsonLd != null) {
      return this._cachedJsonLd;
    }
    if (options.format !== "compact" && options.context != null) {
      throw new TypeError(
@@ -403,7 +403,7 @@ export async function* generateDecoder(
  yield `
    if (!("_fromSubclass" in options) || !options._fromSubclass) {
      try {
        instance.#cachedJsonLd = structuredClone(json);
        instance._cachedJsonLd = structuredClone(json);
      } catch {
        getLogger(["fedify", "vocab"]).warn(
          "Failed to cache JSON-LD: {json}",
+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ async function* generateProperty(
            await this.#fetch${toPascalCase(property.singularName)}(v, options);
          if (fetched == null) return null;
          this.${await getFieldName(property.uri)}[0] = fetched;
          this._cachedJsonLd = undefined;
          return fetched;
        }
        return v;
@@ -162,6 +163,7 @@ async function* generateProperty(
                v, options);
            if (fetched == null) continue;
            vs[i] = fetched;
            this._cachedJsonLd = undefined;
            yield fetched;
            continue;
          }
Loading