@cspark/wasm
v0.2.0
Published
A JavaScript SDK for interacting with the Hybrid Runner API
Maintainers
Readme
@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';
async function main() {
const hybrid = new Hybrid({ tenant: 'my-tenant', token: 'open' }); // no authentication
const response = await hybrid.services.execute('my-folder/my-service', { inputs: { value: 42 } });
console.log(response.data);
}
main();Explore the examples and docs folders to find out more about its capabilities. For more AI-powered guidance and code documentation, check out the DeepWiki (powered by Devin.ai).
Contributing
Visit CONTRIBUTING.md for details on the contribution guidelines, the code of conduct, and the process for submitting pull requests.
