Skip to content

Commit

Permalink
fix(bulk): add missing created field (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed May 28, 2024
1 parent af8a10e commit b661afd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export type BulkQueryBatchResult = Array<{
export type BulkIngestBatchResult = Array<{
id: string | null;
success: boolean;
created: boolean;
errors: string[];
}>;

Expand All @@ -98,6 +99,7 @@ export type BatchResult<Opr extends BulkOperation> = Opr extends
type BulkIngestResultResponse = Array<{
Id: string;
Success: string;
Created: string;
Error: string;
}>;

Expand Down Expand Up @@ -674,6 +676,7 @@ export class Batch<
results = res.map((ret) => ({
id: ret.Id || null,
success: ret.Success === 'true',
created: ret.Created === 'true',
errors: ret.Error ? [ret.Error] : [],
}));
}
Expand Down
1 change: 1 addition & 0 deletions test/bulk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function insertAccounts(
for (const res of batchInsertRes) {
assert.ok(isString(res.id));
assert.ok(res.success === true);
assert.ok(res.created === true);
}

return batchInsertRes;
Expand Down

0 comments on commit b661afd

Please sign in to comment.