@cspark/wasm v0.1.0
@cspark/wasm
This Coherent Spark Node.js SDK provides a convenient way to interact with the Hybrid Runner API.
This guide assumes that you are familiar with Coherent Spark's hybrid deployments. Otherwise, visit the User Guide to learn more about it.
Installation
npm i @cspark/wasmNote:
@cspark/wasmrequires Node.js 14.15 or higher. It also supports other environments such as browsers, Bun, and Deno.
Peer Dependencies
@cspark/wasm is an extension of @cspark/sdk.
Obviously, a runner offers a smaller subset of functionality compared to the SaaS API,
however, extending @cspark/sdk to support the Hybrid Runner API is a good way
to keep the codebase consistent and maintainable. This means, you will need to
install the @cspark/sdk package as a peer dependency. That also means that you may
want to check its documentation to learn about its client options,
error handling, and other features.
Usage
To interact with the Hybrid Runner API, create a HybridClient that points to the
runner's base URL (by default: http://localhost:3000). Depending on your hybrid
runner's configuration, you may or may not need to use authentication.
import Hybrid from '@cspark/wasm';
function main() {
const hybrid = new Hybrid({ tenant: 'my-tenant', token: 'open' }); // no authentication
hybrid.services
.execute('my-folder/my-service', { inputs: { value: 42 } })
.then((response) => console.log(response.data))
.catch(console.error);
}
main();Explore the examples and docs folders to find out more about its capabilities.
Contributing
Visit CONTRIBUTING.md for details on the contribution guidelines, the code of conduct, and the process for submitting pull requests.
Copyright and License
11 months ago
12 months ago