This repository contains the SDK used by Hypermode Functions written in AssemblyScript.
The SDK provides a library to access the Hypermode platform, and helper classes and functions for use with Hypermode Functions, and examples to demonstrate usage.
Please visit docs.hypermode.com for detailed docs covering the Hypermode platform, including this SDK.
Ensure you have Node.js 20 or higher installed and activated.
You can install Node.js with any supported method, including:
- Downloading the official prebuilt installer
- Using a package manager
The examples
folder contains example projects that demonstrate the
features of the Hypermode platform.
Before compiling any example, you must first do the following:
-
Clone this repository locally:
git clone https://github.com/hypermodeAI/functions-as
-
From the repository root, navigate to the
src
folder:cd ./src/
-
Install dependencies with NPM:
npm install
The above steps only needs to be performed one time.
Now that we've set up the prerequisites, we can compile an example project with the following steps:
-
From the repository root, navigate to the example's folder:
cd ./examples/<name>/
-
Install dependencies with NPM:
npm install
-
Build the project with NPM:
npm run build
On a successful build, you'll find the output in the example's build
folder.
NOTE: For convenience, the examples have their
package.json
configured with a local path to the source project, as follows:"dependencies": { "@hypermode/functions-as": "../../src", },In your own project, you should instead reference a version number of the published package, as you would with any other project dependency.
When you are ready to start writing your own Hypermode plugin, we recommend starting from the Hypermode Base Template.
It is pre-configured to use the latest version of this library, and has all of the necessary configuration, scripts, and workflows needed to develop your Hypermode functions.
- Navigate to the Hypermode Base Template repository.
- Click the "Use this template" button in the upper-right corner to create your own repository.
- In the
functions
folder, edit thepackage.json
file to update thename
,version
,description
,author
, andlicense
properties as needed for your purposes. - In the
functions/assembly
folder, begin writing your Hypermode functions inindex.ts
. You can replace the starter function with your own code. You can also add more files to theassembly
folder and useimport
andexport
statements to connect them (as seen in thesimple
example). Note that only the final function exports fromindex.ts
will be registered as Hypermode Functions. - In the root folder of your project, edit the
hypermode.json
manifest file as needed to connect the models and hosts used by your functions.
Currently, your project must be created from the template project in order to publish it to Hypermode.
The Hypermode GitHub application will need to be added to your repository, and Hypermode backend will need to be set up. During this early phase, Hypermode staff will coordinate with you to perform these steps manually. Please contact your Hypermode representative for further details.