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

SDK 'edge' branch #5

Closed
rockacola opened this issue Nov 15, 2019 · 8 comments
Closed

SDK 'edge' branch #5

rockacola opened this issue Nov 15, 2019 · 8 comments
Assignees

Comments

@rockacola
Copy link
Member

Purpose of this ticket is for open discussion on feature roadmap and vision of edge branch of asteroid-sdk-js project.

Overview on intentions:

  • Build as a private package but with intention of becoming a public package in the future
  • Convert to TypeScript
  • Features both vega and deimos related APIs
@rockacola
Copy link
Member Author

rockacola commented Nov 15, 2019

I'll be dubbed its mature release to be 0.1.0, which should include following efforts:

  • Implode experimental repos: planetoid-sdk-js, planetoid-sdk-js-examples
  • Migrate effort of asteroid-api-tests into a new repo, say, asteroid-sdk-js-examples
  • Discuss with Tyler to consider migrate effort of asteroid-testing to merge into asteroid-sdk-js-examples
  • Work with Chris on asteroid-worker-neo-claim to make the implending API changes fromasteroid-sdk-js

@rockacola
Copy link
Member Author

@lllwvlvwlll @birmas Documentations along with asteroid-sdk-js-examples will be available in-time, as for now, here's a quick summary on my vision of the API:

The API comes in 2 flavours: class-based and functional-based.

  • Class-based is suitable for singleton setup where the instance will apply its business logic and do some abstraction for you. Example:
// ES6
const AsteroidDomainUser = require('../dist').AsteroidDomainUser
const config = { networkType: 'stage' }
const adu = new AsteroidDomainUser(config)
// Noticed that the instance has no credential information at the moment
await adu.loginEmail('[email protected]', 'testpassword')
// Access code and refresh code are now been stored in the instance
const res = await adu.getAttributeHeadersByTypes(['name'])


// Wait for 10 minutes so that the access code expires...
// Below will work as the instance will refresh access code automatically when needed
await adu.updatePasswordJwt('newTestPassword')
  • Functional-based are static methods to invoke RPCs without needing to instantiate anything. This is useful when, for whatever reason, you do not wish any business logic is involved and just need helper on executing RPCs. Examples:
// ES6
const rpc = require('../dist').rpc
const url = 'https://stage-user.asteroid.moonlight.io/rpc'
const params = {
  email: '[email protected]',
  password: 'testpassword',
}

const res = await rpc.user.registerEmail(url, params)
console.log('access code:', res.access_code)
console.log('refresh code:', res.refresh_code)

@lllwvlvwlll
Copy link
Member

This works well for me. for internal use cases, we will also need to implement the User class since the JWT tokens are representative of a user and shared across all asteroid platforms (adu and adw).

Regarding the merging of our system testing and the examples branches, I'm alright with this idea as long as the example are all written in a way that supports our test framework since this code is used by our CICD workflows.

@rockacola
Copy link
Member Author

All implementations are now complete in edge branch as per https://github.com/Moonlight-io/asteroid-sdk-js/tree/c2d739ee0aa9fd3d2287d924bd92f7afb70ed89a onward.

@lllwvlvwlll
Copy link
Member

Do you want to merge this in so we can start using this as the default architecture?

@lllwvlvwlll lllwvlvwlll changed the title SDK 'edge' branch disucssion SDK 'edge' branch Nov 20, 2019
@rockacola
Copy link
Member Author

Do you want to merge this in so we can start using this as the default architecture?

Not quite yet, this will happen after preliminary tests are complete.

@rockacola
Copy link
Member Author

Per previous discussions, we will not take action regards to migrate effort of asteroid-testing into asteroid-sdk-js-examples

@rockacola
Copy link
Member Author

rockacola commented Nov 23, 2019

edge branch now merged into master and released as 0.1.0.

Examples and regression tests available on asteroid-sdk-js-examples.

lllwvlvwlll pushed a commit that referenced this issue May 4, 2020
aligns to neo identity contract v0.3.0
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