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

Update CLI to use SDK where possible #60

Open
sangaline opened this issue Jan 22, 2024 · 1 comment
Open

Update CLI to use SDK where possible #60

sangaline opened this issue Jan 22, 2024 · 1 comment
Assignees

Comments

@sangaline
Copy link
Contributor

There's a fair bit of duplicate code that can be eliminated between the two. The most complicated part of this is moving more logging into the client and utility functions.

@sangaline sangaline self-assigned this Jan 22, 2024
sangaline added a commit that referenced this issue Feb 22, 2024
Previously, there was no way for users to create new instances of
`SindriClient` because both the logger and the internal generated API client
operated on a global level. This updates all of that so that instances are
fully independent, and adds a `SindriClient.create()` method to initialize new
client instances. These can use different credentials, have a different log
level, etc.

As part of the modularization, I configured openapi-typescript-codegen to use a
persistent `request.ts` module that we can customize. This allows our special
handling of `FormData` to live outside of the code that gets clobbered with
each regeneration. I also hacked in a `logger` field in the `OpenAPIConfig`
class which `request.ts` uses to add debug logging around all API
requests/responses.

I made significant progress on getting the CLI to use the client consistently.
All of the commands use it for all logging and requests now, but we still have
two parallel implementations of the packaging and polling for circuit
deployment so that's a significant last piece that still needs to be addressed.
Because the client requests are now logged internally, I was able to remove all
of that explicit logging from the CLI commands. This means there's no longer
the fancy logic around not logging repeated poll responses if the status hasn't
changed, but I think it's worth it to have the request logging be more uniform
and universal.

Making these changes required regenerating the internal API client, so this
pulls in miscellaneous backend API changes that have taken place. Nothing
particularly major, adding `noir_version` to Noir circuit responses is one
example, but these are mixed in here.

Connects #60
Closes #58
Closes #70
Merges #73
@KPreisner
Copy link
Member

TODO: Convert to an Epic with multiple Issues

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

No branches or pull requests

2 participants