0.3.5 • Published 2 years ago

fractal-lang v0.3.5

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

fractal-lang

Fractal Lang is an extension of TypeScript for the cloud.

Install

npm install --save-dev fractal-lang

Projen Template

npx projen new --from projen-fractal

Your first Function

The lambda construct from fractal-lang is used to create a serverless Function.

import { lambda } from "fractal-lang";

const HelloFunction = 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 Fractal 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 "fractal-lang";

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 = 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 Fractal, all of this is inferred from your TypeScript code directly.

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago