refactor: AgentSettings Circular Structure and improve internals #412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#minor
Description
This PR replaces the
skipProperties
functionality with an internal_replacer
function when theJSON.stringify
function gets called in thecalculateChangeHash
.The
calculateChangeHash
has been changed to use a new internalstringify
function, that allows to detect and handle Circular Structures.Additionally, the AgentSettings configuration has being added to the
getRuntimeServices
function, so internal functionalities can use them. Not only that, the SkillClient has being updated based on this configuration, that work for both Composer and non-Composer bots.Specific Changes
BotState
class has being updated, removing all theskipProperties
functionality.calculateChangeHash
has being refactored to handle Circular Structures and generate a hash, instead of a plainJSON.stringify
value, so it is easier to debug and identify.ConnectorClientOptions
to thestart
andgetRuntimeServices
functions for Composer bots, so it can be customizable, and delegate to the internalCoreBot
to use.BeginSkill
has being updated, removing theskipProperties
and introducing the new internal_replace
function, for thestringify
functionality to execute.stringify
function that encapsulates the nativeJSON.stringify
function, with the addition to handle Circular Structures and expose the internal_replacer
function to customize it.botFrameworkClientFetchImpl
function to use a single instance ofaxios
and handle its configuration fromConnectorClientOptions
.Testing
The following images show how the
ConnectorClientOptions
can be provided from a Composer bot perspective, the newstringify
functionality that detects and replaces circular references, and the generated hash string.