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

Annotate Wasm async function return types #501

Merged
merged 9 commits into from
Nov 23, 2021
Merged

Conversation

cycraig
Copy link
Contributor

@cycraig cycraig commented Nov 22, 2021

Description of change

Manually annotates Typescript types for the return values of async functions in the Wasm bindings so they are no longer just Promise<Any>.

This affects most of the Client functions:

  • publishDocument -> Promise<Receipt>
  • publishDiff -> Promise<Receipt>
  • publishJSON -> Promise<Receipt>
  • resolve -> Promise<Document>
  • resolveHistory -> Promise<DocumentHistory>
  • resolveDiffHistory -> Promise<DiffChainHistory>

The following functions were left as-is pending the verifiable credential/presentation validation refactor (#312), since those types have not yet been ported properly:

  • checkPresentation -> Promise<Any>
  • checkCredential -> Promise<Any>

Also changes Array<any> returns for DocumentHistory, IntegrationChainHistory, and DiffChainHistory.

NOTE: the signature of Client.publishDocument has changed:

  • publishDocument(any) to publishDocument(Document)

Links to any relevant issues

Partially addresses #309

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Local Wasm tests and examples pass locally. Manually inspected the new Receipt type and generated Typescript definitions.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@cycraig cycraig added Binding Wasm Related to Wasm bindings. Becomes part of the Wasm changelog labels Nov 22, 2021
@cycraig cycraig marked this pull request as ready for review November 23, 2021 08:44
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me from the Rust side, did not check the JS side.

@cycraig cycraig merged commit 540bc5e into dev Nov 23, 2021
@cycraig cycraig deleted the feat/wasm-async-types branch November 23, 2021 13:10
@cycraig cycraig added Added A new feature that requires a minor release. Part of "Added" section in changelog Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Wasm Related to Wasm bindings. Becomes part of the Wasm changelog and removed Wasm Related to Wasm bindings. Becomes part of the Wasm changelog Added A new feature that requires a minor release. Part of "Added" section in changelog labels Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Wasm Related to Wasm bindings. Becomes part of the Wasm changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants