🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@crft/appsync-gateway

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

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.

2.0.0
latest
Source
npm
Version published
Weekly downloads
6
-14.29%
Maintainers
5
Weekly downloads
 
Created
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

aws

FAQs

Package last updated on 14 Apr 2021

Did you know?

Socket

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