Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data-tables] Add options to submitTransaction #32384

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/tables/data-tables/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Breaking Changes

### Bugs Fixed
- Fix issue [#28624](https://github.com/Azure/azure-sdk-for-js/issues/28624) where request options were not available when submitting a transaction operation.

### Other Changes

Expand Down
2 changes: 1 addition & 1 deletion sdk/tables/data-tables/review/data-tables.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class TableClient {
listEntities<T extends object = Record<string, unknown>>(options?: ListTableEntitiesOptions): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>>;
pipeline: Pipeline;
setAccessPolicy(tableAcl: SignedIdentifier[], options?: OperationOptions): Promise<SetAccessPolicyResponse>;
submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse>;
submitTransaction(actions: TransactionAction[], options?: OperationOptions): Promise<TableTransactionResponse>;
readonly tableName: string;
updateEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode, options?: UpdateTableEntityOptions): Promise<UpdateEntityResponse>;
upsertEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode, options?: OperationOptions): Promise<UpsertEntityResponse>;
Expand Down
5 changes: 3 additions & 2 deletions sdk/tables/data-tables/src/TableClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,9 @@ export class TableClient {
* ```
*
* @param actions - tuple that contains the action to perform, and the entity to perform the action with
* @param options - Options for the request.
*/
public async submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse> {
public async submitTransaction(actions: TransactionAction[], options: OperationOptions = {}): Promise<TableTransactionResponse> {
const partitionKey = actions[0][1].partitionKey;
const transactionId = Uuid.generateUuid();
const changesetId = Uuid.generateUuid();
Expand Down Expand Up @@ -888,7 +889,7 @@ export class TableClient {
}
}

return transactionClient.submitTransaction();
return transactionClient.submitTransaction(options);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions sdk/tables/data-tables/src/TableTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ export class InternalTableTransaction {

/**
* Submits the operations in the transaction
* @param options - Options for the request.
*/
public async submitTransaction(): Promise<TableTransactionResponse> {
public async submitTransaction(options: OperationOptions = {}): Promise<TableTransactionResponse> {
await Promise.all(this.state.pendingOperations);
const body = getTransactionHttpRequestBody(
this.state.bodyParts,
Expand All @@ -285,7 +286,7 @@ export class InternalTableTransaction {

return tracingClient.withSpan(
"TableTransaction.submitTransaction",
{} as OperationOptions,
options,
async (updatedOptions) => {
const request = createPipelineRequest({
xirzec marked this conversation as resolved.
Show resolved Hide resolved
url: this.url,
Expand Down
Loading