0.3.3 • Published 3 years ago

faunatils v0.3.3

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Faunatils

FaunaDB Utilities

Installation

$ npm install faunatils

Usage

import {Client} from "faunadb";
import {getByIndex, createCaller, WithRef} from "faunatils";

type Item = {
  color: string;
  name: string;
  price: number;
};

const client = new Client({
  secret: process.env.FAUNA_KEY,
});

const call = createCaller(client);

async function getItemNameAndPriceByColor(color: string) {
  let [item, error] = await call<WithRef<Item>>(
    getByIndex("itemByColor", color),
  );

  if (error) {
    return null;
  }

  return `${item?.data?.name} $${item?.data?.price}`;
}

handler();
0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.6-canary.3

4 years ago

0.1.6-canary.2

4 years ago

0.1.6-canary.1

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago