Skip to content

Commit 34b0214

Browse files
yuchenshiinlined
authored andcommitted
Fix Auth emulator export only exporting 20 users. (#3311)
* Fix Auth emulator export only exporting 20 users. Fixes b/186445689 * Rename the variable limit to maxResults.
1 parent 9b8362c commit 34b0214

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/emulator/auth/operations.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,17 @@ function batchGet(
440440
reqBody: unknown,
441441
ctx: ExegesisContext
442442
): Schemas["GoogleCloudIdentitytoolkitV1DownloadAccountResponse"] {
443-
const limit = Math.min(Math.floor(ctx.params.query.maxResults) || 20, 1000);
443+
const maxResults = Math.min(Math.floor(ctx.params.query.maxResults) || 20, 1000);
444444

445445
const users = state.queryUsers(
446446
{},
447447
{ sortByField: "localId", order: "ASC", startToken: ctx.params.query.nextPageToken }
448448
);
449449
let newPageToken: string | undefined = undefined;
450450

451-
// As a non-standard behavior, passing in limit=-1 will return all users.
452-
if (limit >= 0 && users.length >= limit) {
453-
users.length = limit;
451+
// As a non-standard behavior, passing in maxResults=-1 will return all users.
452+
if (maxResults >= 0 && users.length >= maxResults) {
453+
users.length = maxResults;
454454
if (users.length) {
455455
newPageToken = users[users.length - 1].localId;
456456
}

src/emulator/hubExport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class HubExport {
182182
{
183183
host,
184184
port,
185-
path: `/identitytoolkit.googleapis.com/v1/projects/${this.projectId}/accounts:batchGet?limit=-1`,
185+
path: `/identitytoolkit.googleapis.com/v1/projects/${this.projectId}/accounts:batchGet?maxResults=-1`,
186186
headers: { Authorization: "Bearer owner" },
187187
},
188188
accountsFile

0 commit comments

Comments
 (0)