From 4c1277b2669b0c43543d73ddcd4112f0434a3dc8 Mon Sep 17 00:00:00 2001 From: patuwwy Date: Mon, 27 Mar 2023 14:10:40 +0000 Subject: [PATCH] Fix dropping STH by id --- packages/cli/src/lib/commands/space.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/lib/commands/space.ts b/packages/cli/src/lib/commands/space.ts index 901765d0c..3cbdbb9d5 100644 --- a/packages/cli/src/lib/commands/space.ts +++ b/packages/cli/src/lib/commands/space.ts @@ -86,19 +86,21 @@ export const space: CommandDefinition = (program) => { .argument("", "The name of the Space") .option("--id ", "Hub Id") .option("--all", "Disconnects all self-hosted Hubs connected to Space", false) - .action(async (spaceName: string, id: string, all: string) => { + .action(async (spaceName: string, options: { id: string, all: boolean }) => { const mwClient = getMiddlewareClient(); const managerClient = mwClient.getManagerClient(spaceName); let opts = { } as PostDisconnectPayload; - if (typeof id === "string") { - opts = { id }; + if (typeof options.id === "string") { + opts = { id: options.id }; } - if (all) { + if (options.all) { opts = { limit: 0 }; } + console.dir({spaceName, opts}, { depth: 2 }); + if (!Object.keys(opts).length) { throw new Error("Missing --id or --all"); }