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

feat: deprecate HttpAgent constructor in favor of new create #873

Merged
merged 7 commits into from
Jun 27, 2024

Conversation

krpeacock
Copy link
Contributor

Description

Following the pattern used by other interfaces in the library, this function switches to an async create method, that will be able to make the syncTime and fetchRootKey calls before completing. This will also support future async setup calls if needed in the future. createSync initializes the agent but skips any async steps, and is useful for testing or more sophisticated applications

The agent also has a from method, and will support either the v1 or v2 agent interfaces.

The HttpAgent also switches to true es6 private class fields, and will formally reveal its config and its host as fields. This supports the from method, but the _-prefixed methods from older HttpAgents will be supported.

Note: the constructor is marked deprecated in this PR. Existing code will not break yet, but will inform the developer that they should switch to create or createSync`.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

Checklist:

  • My changes follow the guidelines in CONTRIBUTING.md.
  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@krpeacock krpeacock requested a review from a team as a code owner April 12, 2024 23:37
@krpeacock krpeacock changed the title feat!: deprecate HttpAgent constructor in favor of new create feat: deprecate HttpAgent constructor in favor of new create Apr 12, 2024
@krpeacock krpeacock marked this pull request as draft April 12, 2024 23:41
Copy link
Contributor

github-actions bot commented May 1, 2024

size-limit report 📦

Path Size
@dfinity/agent 86 KB (+0.08% 🔺)
@dfinity/candid 13.58 KB (0%)
@dfinity/principal 4.97 KB (0%)
@dfinity/auth-client 60.84 KB (+0.08% 🔺)
@dfinity/assets 80.65 KB (+0.07% 🔺)
@dfinity/identity 58.03 KB (+0.06% 🔺)
@dfinity/identity-secp256k1 266.58 KB (+0.05% 🔺)

@krpeacock krpeacock marked this pull request as ready for review May 1, 2024 22:28
@krpeacock krpeacock marked this pull request as draft May 22, 2024 12:47
@krpeacock
Copy link
Contributor Author

@roelstorms

@krpeacock krpeacock marked this pull request as ready for review June 26, 2024 22:57
@krpeacock krpeacock merged commit 9758583 into main Jun 27, 2024
16 checks passed
@krpeacock krpeacock deleted the kai/http-agent-private-attributes branch June 27, 2024 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants