diff --git a/packages/cli/src/commands/tokenplan/assign-seats.ts b/packages/cli/src/commands/tokenplan/assign-seats.ts index 5dd1e76..9d04759 100644 --- a/packages/cli/src/commands/tokenplan/assign-seats.ts +++ b/packages/cli/src/commands/tokenplan/assign-seats.ts @@ -86,11 +86,8 @@ export default defineCommand({ throw new BailianError("Missing required argument --seat-type.", ExitCode.USAGE); } - const accountIds = flags.accountId; - const hasAccountIds = - (Array.isArray(accountIds) && accountIds.length > 0) || - (typeof accountIds === "string" && accountIds.length > 0); - if (!hasAccountIds) { + const accountIds = flags.accountId as string[] | undefined; + if (!accountIds || accountIds.length === 0) { throw new BailianError("Missing required argument --account-id.", ExitCode.USAGE); } @@ -161,11 +158,9 @@ function buildQueryParams( if (flags.namespaceId) params.NamespaceId = flags.namespaceId as string; if (flags.locale) params.Locale = flags.locale as string; - const accountIds = flags.accountId as string | string[] | undefined; - if (Array.isArray(accountIds) && accountIds.length > 0) { + const accountIds = flags.accountId as string[] | undefined; + if (accountIds && accountIds.length > 0) { params.AccountIds = accountIds; - } else if (typeof accountIds === "string" && accountIds.length > 0) { - params.AccountIds = [accountIds]; } return params; diff --git a/packages/cli/src/commands/tokenplan/seats.ts b/packages/cli/src/commands/tokenplan/seats.ts index 16ff409..879ee01 100644 --- a/packages/cli/src/commands/tokenplan/seats.ts +++ b/packages/cli/src/commands/tokenplan/seats.ts @@ -143,18 +143,20 @@ function buildQueryParams(flags: GlobalFlags): Record 0) { - params.StatusList = status as string[]; - } else if (typeof status === "string" && status.length > 0) { - params.StatusList = [status]; + const status = flags.status as string[] | undefined; + if (status && status.length > 0) { + params.StatusList = status; } if (flags.seatId) params.SeatId = flags.seatId as string; if (flags.seatType) params.SeatType = flags.seatType as string; if (typeof flags.queryAssigned === "string" && flags.queryAssigned.length > 0) { - params.QueryAssigned = flags.queryAssigned; + const val = flags.queryAssigned.toLowerCase(); + if (val !== "true" && val !== "false") { + throw new BailianError("--query-assigned must be 'true' or 'false'.", ExitCode.USAGE); + } + params.QueryAssigned = val; } return params;