Unverified Commit 088024bb authored by Hong Minhee's avatar Hong Minhee
Browse files

Log warning messages if deprecated APIs are called

parent 0651af76
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -127,6 +127,11 @@ The `["fedify", "federation", "outbox"]` category is used for logging messages
related to outgoing activities.  When you cannot send an activity, you can
check the log messages in this category with the `"debug"` level.

### `["fedify", "x", "fresh"]`

The `["fedify", "x", "fresh"]` category is used for logging messages related
to the `@fedify/fedify/x/fresh` module.


Sinks
-----
+3 −0
Original line number Diff line number Diff line
@@ -1104,6 +1104,9 @@ export class Federation<TContextData> {
    request: Request,
    options: FederationFetchOptions<TContextData>,
  ): Promise<Response> {
    getLogger(["fedify", "federation"]).warn(
      "Federation.handle() is deprecated.  Use Federation.fetch() instead.",
    );
    return this.fetch(request, options);
  }

+11 −2
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
 * @module
 * @since 0.4.0
 */
import { getLogger } from "@logtape/logtape";
import type {
  Federation,
  FederationFetchOptions,
@@ -75,9 +76,17 @@ export function integrateFetchOptions(
 *
 * @param context A Fresh context.
 * @returns Options for the {@link Federation.handle} method.
 * @deprecated
 * @deprecated Use {@link integrateFetchOptions} instead.
 */
export const integrateHandlerOptions = integrateFetchOptions;
export function integrateHandlerOptions(
  context: FreshContext,
): Omit<FederationFetchOptions<void>, "contextData"> {
  getLogger(["fedify", "x", "fresh"]).warn(
    "The integrateHandlerOptions() is deprecated.  " +
      "Use the integrateFetchOptions() instead.",
  );
  return integrateFetchOptions(context);
}

/**
 * Create a Fresh middleware handler to integrate with the {@link Federation}