Skip to content

feat: implicit init #15

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: implicit init #15

wants to merge 3 commits into from

Conversation

rohan-chaturvedi
Copy link
Member

Overview

The SDK currently requires that await init() is called before class methods like get or create can be called. Class methods run before init also return the misleading exception 'Invalid app id`

Proposed changes

Run init() internally if not called manually. The SDK now tracks the initialized state internally and will automatically call init() if not initialized. This means clients no longer need to await init():

const phase = new Phase(token, host)

await phase.get(getOptions) // This works without init now

await init() can still be run externally, so this is not a breaking change.

Miscellaneous other fixes

  • Made most internal variables private
  • Made env name checks for create, update, and delete case insensitive to be consistent with get
  • Bump version to 3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant