eventual-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.3.12 • Public • Published

eventual-sdk

Eventual SDK is an extension of TypeScript for the cloud.

Install

npm install --save-dev eventual-sdk

Projen Template

npx projen new --from projen-eventual

Your 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.

Readme

Keywords

none

Package Sidebar

Install

npm i eventual-sdk

Weekly Downloads

0

Version

0.3.12

License

Apache-2.0

Unpacked Size

277 kB

Total Files

165

Last publish

Collaborators

  • sam-goodwin