eventual-sdk v0.3.12
eventual-sdk
Eventual SDK is an extension of TypeScript for the cloud.
Install
npm install --save-dev eventual-sdkProjen Template
npx projen new --from projen-eventualYour first Function
The lambda construct from eventual-sdk is used to create a serverless Function.
import { Lambda } from "eventual-sdk";
const HelloFunction = new Lambda((name: string) => {
console.log(`hello ${name}`);
});The HelloFunction expects a JSON payload that matches the function signature.
{
"name": "Sam"
}If you call the function with an invalid payload, an error is thrown. This type-safety is inferred directly by parsing the TypeScript code and enforced by the Eventual Cloud Platform.
Store and Retrieve Data
Databases can be created and used as simple as an in-memory data structure.
import { Lambda, Table, shapeOf } from "eventual-sdk";
interface Person {
name: string;
}
const People = new Table({
item: shapeOf<Person>(),
key: "name",
});The People Table configures a serverless key-value database for storing Person objects. It can be simply referenced from within a lambda closure to implement backend capabilities such as getting an item.
const GetPersonFunction = new Lambda((name: string) => People.get(name));In an ordinary IaC framework, developers would be required to write boilerplate to configure permissions, environment variables and instantiate client libraries, all just to interact with the Table.
In Eventual, all of this is inferred from your TypeScript code directly.