Socket
Socket
Sign inDemoInstall

@crft/appsync-gateway

Package Overview
Dependencies
44
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @crft/appsync-gateway

Utility method for making API calls to AppSync from Lambdas in AWS.


Version published
Weekly downloads
88
increased by633.33%
Maintainers
5
Install size
515 kB
Created
Weekly downloads
 

Readme

Source

Appsync API Gateway

Utility method for making API calls to AppSync from Lambdas in AWS.

This library essentially implements the suggested approach outlined by AWS Amplify Docs in a nice package.

Usage

Install via NPM:

npm i @crft/appsync-gateway --save

then use like:

const {
  GraphQLGateway,
  IAMCredentialsStrategy,
  APIKeyCredentialsStrategy,
  AuthHeaderCredentialsStrategy
} = require('@crft/appsync-gateway');

// IAM Mode
const creds = new IAMCredentialsStrategy();

// API Key Mode
const creds = new APIKeyCredentialsStrategy(API_KEY);

// Auth Headers Mode
const creds = new AuthHeaderCredentialsStrategy(authHeader);

const gateway = new GraphQLGateway(
  creds,
  process.env.API_API_GRAPHQLAPIENDPOINTOUTPUT
);

const myQuery = `
  query ListTodosOperation {
    listTodos {
      items {
        title
      }
    }
  }
`;

await gateway.runQuery({
  operationName: 'ListTodosOperation',
  query: myQuery,
  variables: {
    input: {}
  }
});

Commands

  • npm build - Run the typescript build

Keywords

FAQs

Last updated on 14 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc