Unverified Commit 7e03a2d6 authored by Hong Minhee's avatar Hong Minhee
Browse files

Merge pull request #342 from Palcimer/palcimer-cli-inbox-issue-191

parents 45539bec f7e446c7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -113,7 +113,12 @@ the versioning.
     -  Added utility types `ConstructorWithTypeId` and `ParamsKeyPath` for
        custom collection dispatchers.

 -  The `fedify inbox` command now displays the type of the object contained
    in each activity, in addition to the activity's own type.
    [[#191], [#342] by Jang Hanarae]

[#168]: https://github.com/fedify-dev/fedify/issues/168
[#191]: https://github.com/fedify-dev/fedify/issues/191
[#197]: https://github.com/fedify-dev/fedify/issues/197
[#248]: https://github.com/fedify-dev/fedify/issues/248
[#260]: https://github.com/fedify-dev/fedify/issues/260
@@ -136,6 +141,7 @@ the versioning.
[#328]: https://github.com/fedify-dev/fedify/pull/328
[#331]: https://github.com/fedify-dev/fedify/pull/331
[#332]: https://github.com/fedify-dev/fedify/pull/332
[#342]: https://github.com/fedify-dev/fedify/pull/342


Version 1.7.7
+9 −5
Original line number Diff line number Diff line
@@ -399,18 +399,22 @@ function printServerInfo(fedCtx: Context<ContextData>): void {
    .render();
}

function printActivityEntry(idx: number, entry: ActivityEntry): void {
async function printActivityEntry(
  idx: number,
  entry: ActivityEntry,
): Promise<void> {
  const request = entry.request.clone();
  const response = entry.response?.clone();
  const url = new URL(request.url);
  const activity = entry.activity;
  const object = await activity?.getObject();
  new Table(
    [new Cell("Request #:").align("right"), colors.bold(idx.toString())],
    [
      new Cell("Activity type:").align("right"),
      activity == null
        ? colors.red("failed to parse")
        : colors.green(activity.constructor.name),
      activity == null ? colors.red("failed to parse") : colors.green(
        `${activity.constructor.name}(${object?.constructor.name})`,
      ),
    ],
    [
      new Cell("HTTP request:").align("right"),
@@ -508,7 +512,7 @@ function createFetchHandler(
      recordingSink.stopRecording();
      activities[idx].response = response.clone();
      activities[idx].logs = recordingSink.getRecords();
      printActivityEntry(idx, activities[idx]);
      await printActivityEntry(idx, activities[idx]);
    }
    return response;
  };