JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1255
  • Score
    100M100P100Q121381F
  • License MIT

Package Exports

  • appsync-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (appsync-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Appsync Client

Built with
typescript version dependants license

A lightweight Appsync client that signs requests for you - perfect for running on Lambdas or servers. This module has not been tested for use on the browser.

When using tree-shaking, the impact on your bundle size is just a few kb.

Use

import AppsyncClient from "appsync-client";

async function getTodo() {

    // Create a client
    const client = new AppsyncClient({
        // Required
        apiUrl: "https://xxx.appsync-api.xx-xxxx-x.amazonaws.com/graphql",
        // Optional - these will default to process.env values (e.g. the IAM
        // role of the Lambda)
        accessKeyId: "",
        secretAccessKey: "",
        sessionToken: ""
    });

    // Query for TODOS
    const res = await client.request({
        // The query string - can be manually written, or you can use amplify
        // codegen to create these
        query: `query Todo(id: $id) {
            getTodo(id: $id) {
                id
                title
                description
            }
        }`,
        // Variables to replace (here we are replacing $id with "todoId")
        variables: {
            id: "todoId"
        }
    );
}

Checklist

CD Feature Provided
Typescript
Linting (AirBnB + Prettier)
Unit tests (Jest)
100% test coverage
Github Continuous Deployment

Built by Skyhook

This module is contributed by the team at Skyhook.