-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor SubmitTransaction to fix multiple send issue #15493
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the new test here! Happy for you to pushback on the style changes, but please update the documentation in the constructor.
@@ -162,7 +158,7 @@ export class TableClient { | |||
if (isInternalClientOptions(clientOptions)) { | |||
// The client is meant to be an intercept client (for Transaction), so we need to create only the intercepting | |||
// pipelines. | |||
internalPipelineOptions.pipeline = clientOptions.innerTransactionRequest.createPipeline(); | |||
internalPipelineOptions.pipeline = createEmptyPipeline(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above now seems wrong since we no longer create an intercepting pipeline, can you update it to explain what the new strategy is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, good catch! I'll remove the condition altogether since we no longer need it
|
||
this.interceptClient = interceptClient; | ||
// Reset-able properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible for us to just call reset
here instead of having the code duplicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to do that but TS is complaining on lines 99-103 that the properties are not assigned in the constructor. I'm investigating if there is a way to tell TS that we are actually initializing those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a definite assignment assertion when declaring them like this
private transactionId!: string;
private changesetId!: string;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, @richardpark-msft gave me the idea of making these reset-able properties an object and having the initialize function return the initialized object. This gives us a nice separation of the properties that may be reset while allowing us for code reuse. Thanks, guys for your help improving this 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xirzec I didn't see your comment before my last post. What do you think about having these reset-able properties as an object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with that approach
* Removes all the policies on a pipeline. | ||
* @param pipeline - Client pipeline | ||
*/ | ||
export function clearTransactionPipeline(pipeline: Pipeline): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering: Would it make sense to merge clearTransactionPipeline
and addTransactionPipelinePolicies
into a single resetTransactionPipeline
? It seems like these are always called together and that calling one without the other is likely to leave you with a pipeline that is not usable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Love the object approach for the resettable state.
@joheredi I notice we now have a circular import between TableClient.ts and TableTransaction.ts -- doesn't this cause some trouble for bundlers? |
Microsoft.ApiManagement : Release api-version 2021-04-01-preview (Azure#15832) * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * fix tenant sync contract * fix linter issues * examples for managed identity backup * prettier * Fix Apis-Get and updated comments for api-version 2021-04-01-preview (#3) * add schema definition fix from 2021-01-01-preview * added fix * small fix (#6) * 'examples' added to RepresentationContract (#7) Co-authored-by: Alexander Zaslonov <zaslonov.alexander@gmail.com> Co-authored-by: DreamlessA <DreamlessA@users.noreply.github.com> Co-authored-by: Alan Feng <alanfeng@microsoft.com> Co-authored-by: Jatin Sanghvi <20547963+JatinSanghvi@users.noreply.github.com> Co-authored-by: Nicolás Barrera <nicolasbarrera@outlook.com> Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> Co-authored-by: VitaliyKurokhtin <vitaliik@microsoft.com> Co-authored-by: RupengLiu <rliu1211@terpmail.umd.edu> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: RupengLiu <rupliu@microsoft.com> Co-authored-by: VitaliyKurokhtin <Vitaliy.Kurokhtin@gmail.com>
Schema resource added in REST API Spec for api-version 2021-04-01-preview (Azure#15667) * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Rename from SchemaContract to ApiSchemaContract * apimschema.json added to last apim preview version * Completing specification for Schema resource. Fixing changes in SchemaContract. * Value field added to Schema resource specification. * path fixed. Renamed from ApiSchema to Schema. Adding suppression rule to readme.md Custom word added for spellcheck * Fixing PR observations. * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * Merge main * Modifications to Schema definition to add "description" field. Updating examples of Schema. * Fixing apimanagement.json * Prettier applied in files * Fixing PR comments * fixing x-ms-long-running-operation. * x-ms-long-running-operation : true in apischema. * Removing "Resource" type from apimanagement.json * Apimschema.json updated to point to types.json for ErrorResponse. * undoing change of responseBody * Updating ErrorResponse. * Fixing definitions merge. Co-authored-by: Samir Solanki <samirsolanki@outlook.com> Co-authored-by: Alexander Zaslonov <zaslonov.alexander@gmail.com> Co-authored-by: DreamlessA <DreamlessA@users.noreply.github.com> Co-authored-by: Alan Feng <alanfeng@microsoft.com> Co-authored-by: Jatin Sanghvi <20547963+JatinSanghvi@users.noreply.github.com> Co-authored-by: Nicolás Barrera <nicolasbarrera@outlook.com> Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> Co-authored-by: VitaliyKurokhtin <vitaliik@microsoft.com> Co-authored-by: Christian Palomares <cpalomar@microsoft.com> Co-authored-by: RupengLiu <rliu1211@terpmail.umd.edu> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Schema resource added in REST API Spec for api-version 2021-08-01 (Azure#16715) * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Rename from SchemaContract to ApiSchemaContract * apimschema.json added to last apim preview version * Completing specification for Schema resource. Fixing changes in SchemaContract. * Value field added to Schema resource specification. * path fixed. Renamed from ApiSchema to Schema. Adding suppression rule to readme.md Custom word added for spellcheck * Fixing PR observations. * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * Adds base for updating Microsoft.ApiManagement from version preview/2021-04-01-preview to version 2021-08-01 * Updates readme * Updates API version in new specs and examples * Merge main * Modifications to Schema definition to add "description" field. Updating examples of Schema. * Fixing apimanagement.json * Prettier applied in files * Fixing PR comments * fixing x-ms-long-running-operation. * x-ms-long-running-operation : true in apischema. * Removing "Resource" type from apimanagement.json * Apimschema.json updated to point to types.json for ErrorResponse. * Merging from 2021-04-01-preview to 2021-08-01 stable version. * undoing change of responseBody * Updating ErrorResponse. * Fixing definitions merge. * Changing definitions to fix output of examples. * Changes in definitions * Updating response in some examples. * Rolling back ApiSchema -> Schema Schema -> GlobalSchema * Changes to undo apimapis.json and adding prefix for Global example Schemas. * Setting x-ms-long-running-operation-options to location. Co-authored-by: Samir Solanki <samirsolanki@outlook.com> Co-authored-by: Alexander Zaslonov <zaslonov.alexander@gmail.com> Co-authored-by: DreamlessA <DreamlessA@users.noreply.github.com> Co-authored-by: Alan Feng <alanfeng@microsoft.com> Co-authored-by: Jatin Sanghvi <20547963+JatinSanghvi@users.noreply.github.com> Co-authored-by: Nicolás Barrera <nicolasbarrera@outlook.com> Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> Co-authored-by: VitaliyKurokhtin <vitaliik@microsoft.com> Co-authored-by: Christian Palomares <cpalomar@microsoft.com> Co-authored-by: RupengLiu <rliu1211@terpmail.umd.edu> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Schema resource added in REST API Spec for api-version 2021-08-01 (Azure#16715) * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Rename from SchemaContract to ApiSchemaContract * apimschema.json added to last apim preview version * Completing specification for Schema resource. Fixing changes in SchemaContract. * Value field added to Schema resource specification. * path fixed. Renamed from ApiSchema to Schema. Adding suppression rule to readme.md Custom word added for spellcheck * Fixing PR observations. * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * Adds base for updating Microsoft.ApiManagement from version preview/2021-04-01-preview to version 2021-08-01 * Updates readme * Updates API version in new specs and examples * Merge main * Modifications to Schema definition to add "description" field. Updating examples of Schema. * Fixing apimanagement.json * Prettier applied in files * Fixing PR comments * fixing x-ms-long-running-operation. * x-ms-long-running-operation : true in apischema. * Removing "Resource" type from apimanagement.json * Apimschema.json updated to point to types.json for ErrorResponse. * Merging from 2021-04-01-preview to 2021-08-01 stable version. * undoing change of responseBody * Updating ErrorResponse. * Fixing definitions merge. * Changing definitions to fix output of examples. * Changes in definitions * Updating response in some examples. * Rolling back ApiSchema -> Schema Schema -> GlobalSchema * Changes to undo apimapis.json and adding prefix for Global example Schemas. * Setting x-ms-long-running-operation-options to location. Co-authored-by: Samir Solanki <samirsolanki@outlook.com> Co-authored-by: Alexander Zaslonov <zaslonov.alexander@gmail.com> Co-authored-by: DreamlessA <DreamlessA@users.noreply.github.com> Co-authored-by: Alan Feng <alanfeng@microsoft.com> Co-authored-by: Jatin Sanghvi <20547963+JatinSanghvi@users.noreply.github.com> Co-authored-by: Nicolás Barrera <nicolasbarrera@outlook.com> Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> Co-authored-by: VitaliyKurokhtin <vitaliik@microsoft.com> Co-authored-by: Christian Palomares <cpalomar@microsoft.com> Co-authored-by: RupengLiu <rliu1211@terpmail.umd.edu> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Fixes #15403
Sending more than one transaction had an unexpected behavior, sending empty transaction bodies after the first request.
This PR refactors the way we build the transaction request so that there is less state to keep track of and make sure we reset the remaining state and pipeline policies before starting to build a new Transaction Request