Unverified Commit 239afc0e authored by Hong Minhee's avatar Hong Minhee
Browse files

Merge tag '1.0.1'

Fedify 1.0.1
parents e38d5e5d 1fec13e4
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -4,6 +4,24 @@ Fedify changelog
================

Version 1.1.0
-------------

To be released.


Version 1.0.1
-------------

Released on September 26, 2024.

 -  Fixed deprecation messages related to the `{handle}` variable in URL
    templates; they had had wrong placeholders in the message templates.

 -  Fixed a bug of `Object.toJsonLd()` method where it had not fall back to
    the proper compact form when the heuristic compact form was not available.


Version 1.0.0
--------------

Released on September 26, 2024.
@@ -174,6 +192,15 @@ Released on September 26, 2024.
[#137]: https://github.com/dahlia/fedify/issues/137


Version 0.15.2
--------------

Released on September 26, 2024.

 -  Fixed a bug of `Object.toJsonLd()` method where it had not fall back to
    the proper compact form when the heuristic compact form was not available.


Version 0.15.1
--------------

@@ -247,6 +274,15 @@ Released on September 11, 2024.
    object.


Version 0.14.5
--------------

Released on September 26, 2024.

 -  Fixed a bug of `Object.toJsonLd()` method where it had not fall back to
    the proper compact form when the heuristic compact form was not available.


Version 0.14.4
--------------

+441 −309

File changed.

Preview size limit exceeded, changes collapsed.

+17 −15
Original line number Diff line number Diff line
@@ -47,21 +47,7 @@ export async function* generateEncoder(
  `;
  if (isCompactableType(typeUri, types)) {
    yield `
    if (
      options.format == null
    `;
    for (const property of type.properties) {
      if (!property.range.every((r) => isCompactableType(r, types))) {
        yield `
        && (
          this.${await getFieldName(property.uri)} == null ||
          this.${await getFieldName(property.uri)}.length < 1
        )
        `;
      }
    }
    yield `
    ) {
    if (options.format == null && this.isCompactable()) {
    `;
    if (type.extends == null) {
      yield "const result: Record<string, unknown> = {};";
@@ -253,6 +239,22 @@ export async function* generateEncoder(
    }
    return compacted;
  }

  protected isCompactable(): boolean {
`;
  for (const property of type.properties) {
    if (!property.range.every((r) => isCompactableType(r, types))) {
      yield `
      if (
        this.${await getFieldName(property.uri)} != null &&
        this.${await getFieldName(property.uri)}.length > 0
      ) return false;
      `;
    }
  }
  yield `
    return ${type.extends == null ? "true" : "super.isCompactable()"};
  }
  `;
}

+3 −0
Original line number Diff line number Diff line
@@ -442,6 +442,9 @@ export function isCompactableType(
  } else if (typeUri in types) {
    const type = types[typeUri];
    if (type.compactName == null) return false;
    else if (type.extends != null && !isCompactableType(type.extends, types)) {
      return false;
    }
    const defaultContext = type.defaultContext;
    return defaultContext != null &&
        HEURISTICS_CONTEXTS.includes(defaultContext as string) ||
+18 −18
Original line number Diff line number Diff line
@@ -701,8 +701,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "actor"]).warn(
        "The {handle} variable in the actor dispatcher path is deprecated. " +
          "Use {identifier} instead.",
        "The {{handle}} variable in the actor dispatcher path is deprecated. " +
          "Use {{identifier}} instead.",
      );
    }
    const callbacks: ActorCallbacks<TContextData> = {
@@ -1020,8 +1020,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
      }
      if (variables.has("handle")) {
        getLogger(["fedify", "federation", "inbox"]).warn(
          "The {handle} variable in the inbox dispatcher path is deprecated. " +
            "Use {identifier} instead.",
          "The {{handle}} variable in the inbox dispatcher path is deprecated. " +
            "Use {{identifier}} instead.",
        );
      }
      this.inboxPath = path;
@@ -1097,8 +1097,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "outbox"]).warn(
        "The {handle} variable in the outbox dispatcher path is deprecated. " +
          "Use {identifier} instead.",
        "The {{handle}} variable in the outbox dispatcher path is deprecated. " +
          "Use {{identifier}} instead.",
      );
    }
    const callbacks: CollectionCallbacks<
@@ -1173,8 +1173,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "collection"]).warn(
        "The {handle} variable in the following collection dispatcher path " +
          "is deprecated. Use {identifier} instead.",
        "The {{handle}} variable in the following collection dispatcher path " +
          "is deprecated. Use {{identifier}} instead.",
      );
    }
    const callbacks: CollectionCallbacks<
@@ -1245,8 +1245,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "collection"]).warn(
        "The {handle} variable in the followers collection dispatcher path " +
          "is deprecated. Use {identifier} instead.",
        "The {{handle}} variable in the followers collection dispatcher path " +
          "is deprecated. Use {{identifier}} instead.",
      );
    }
    const callbacks: CollectionCallbacks<
@@ -1313,8 +1313,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "collection"]).warn(
        "The {handle} variable in the liked collection dispatcher path " +
          "is deprecated. Use {identifier} instead.",
        "The {{handle}} variable in the liked collection dispatcher path " +
          "is deprecated. Use {{identifier}} instead.",
      );
    }
    const callbacks: CollectionCallbacks<
@@ -1389,8 +1389,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "collection"]).warn(
        "The {handle} variable in the featured collection dispatcher path " +
          "is deprecated. Use {identifier} instead.",
        "The {{handle}} variable in the featured collection dispatcher path " +
          "is deprecated. Use {{identifier}} instead.",
      );
    }
    const callbacks: CollectionCallbacks<
@@ -1465,8 +1465,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
    }
    if (variables.has("handle")) {
      getLogger(["fedify", "federation", "collection"]).warn(
        "The {handle} variable in the featured tags collection dispatcher " +
          "path is deprecated. Use {identifier} instead.",
        "The {{handle}} variable in the featured tags collection dispatcher " +
          "path is deprecated. Use {{identifier}} instead.",
      );
    }
    const callbacks: CollectionCallbacks<
@@ -1539,8 +1539,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
      this.inboxPath = inboxPath;
      if (variables.has("handle")) {
        getLogger(["fedify", "federation", "inbox"]).warn(
          "The {handle} variable in the inbox path is deprecated. " +
            "Use {identifier} instead.",
          "The {{handle}} variable in the inbox path is deprecated. " +
            "Use {{identifier}} instead.",
        );
      }
    }
Loading