diff --git a/packages/cli/src/commands/tokenplan/assign-seats.ts b/packages/cli/src/commands/tokenplan/assign-seats.ts index d453ae4..5dd1e76 100644 --- a/packages/cli/src/commands/tokenplan/assign-seats.ts +++ b/packages/cli/src/commands/tokenplan/assign-seats.ts @@ -165,7 +165,7 @@ function buildQueryParams( if (Array.isArray(accountIds) && accountIds.length > 0) { params.AccountIds = accountIds; } else if (typeof accountIds === "string" && accountIds.length > 0) { - params.AccountIds = accountIds; + params.AccountIds = [accountIds]; } return params; diff --git a/packages/cli/tests/e2e/tokenplan.e2e.test.ts b/packages/cli/tests/e2e/tokenplan.e2e.test.ts index 1635bbf..e264cbf 100644 --- a/packages/cli/tests/e2e/tokenplan.e2e.test.ts +++ b/packages/cli/tests/e2e/tokenplan.e2e.test.ts @@ -328,6 +328,8 @@ describe("e2e: tokenplan dry-run", () => { expect(data.query?.WorkspaceId).toBe("ws_456"); expect(data.query?.SeatType).toBe("standard"); expect(data.query?.AccountIds).toEqual(["acc_1", "acc_2"]); + expect(data.endpoint).toMatch(/AccountIds\.1=acc_1/); + expect(data.endpoint).toMatch(/AccountIds\.2=acc_2/); }); test("add-member --dry-run 输出 endpoint 和 query 参数", async () => { diff --git a/packages/core/src/client/ak-sign.ts b/packages/core/src/client/ak-sign.ts index d807ad3..1f55c46 100644 --- a/packages/core/src/client/ak-sign.ts +++ b/packages/core/src/client/ak-sign.ts @@ -28,9 +28,9 @@ export function buildCanonicalQuery(params: Record { + expect( + buildCanonicalQuery({ + WorkspaceId: "ws_1", + SeatType: "pro", + AccountIds: ["acc_1", "acc_2"], + }), + ).toBe("AccountIds.1=acc_1&AccountIds.2=acc_2&SeatType=pro&WorkspaceId=ws_1"); +}); + +test("buildCanonicalQuery uses single indexed key for one-element arrays", () => { + expect( + buildCanonicalQuery({ + AccountIds: ["acc_2bd88814c31743d9aa5833dc16b3b8e0"], + }), + ).toBe("AccountIds.1=acc_2bd88814c31743d9aa5833dc16b3b8e0"); +});