Unverified Commit 379c2be3 authored by Hong Minhee's avatar Hong Minhee
Browse files

Fix example code based on review feedback

- Make ActivityRecord.verified optional instead of required
- Add proper type annotation for resultCallback parameter
- Remove hardcoded verified: true for outbound activities
parent 3c7c9d06
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -312,13 +312,13 @@ interface ActivityRecord {
  direction: "inbound" | "outbound";
  activity: unknown;
  timestamp: Date;
  verified: boolean;
  verified?: boolean;
}

export class FedifyDebugExporter implements SpanExporter {
  private activities: ActivityRecord[] = [];

  export(spans: ReadableSpan[], resultCallback: (result) => void): void {
  export(spans: ReadableSpan[], resultCallback: (result: { code: ExportResultCode }) => void): void {
    for (const span of spans) {
      // Capture inbound activities
      if (span.name === "activitypub.inbox") {
@@ -349,7 +349,6 @@ export class FedifyDebugExporter implements SpanExporter {
              event.attributes["activitypub.activity.json"] as string
            ),
            timestamp: new Date(span.startTime[0] * 1000),
            verified: true,
          });
        }
      }