@appsync-butler/sst
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

AppSync Butler (SST)

This package is concerned with loading on-disk resolvers into SST AppSync API constructs. This is not necessarily required when using SST, you can still load on-disk resolvers and functions using @appsync-butler/core only:

import { Loader } from '@appsync-butler/core';
import { StackContext, AppSyncApi } from '@serverless-stack/resources';

export function MyStack({ stack }: StackContext) {
    const api = new AppSyncApi(stack, 'api');
    const loader = new Loader(stack, { api: api.cdk.graphqlApi });
    loader.load();
}

This package introduces SstLoader to load resolvers with SST compatibility. This might be useful for specific use cases.

import { SstLoader } from '@appsync-butler/sst';
import { StackContext, AppSyncApi } from '@serverless-stack/resources';
import { Resolver } from "@aws-cdk/aws-appsync-alpha";

export function MyStack({ stack }: StackContext) {
    const api = new AppSyncApi(stack, 'api');
    const loader = new SstLoader(stack, { api });
    loader.load();

    // Suppose we have the following on-disk resolver:
    // vtl/resolvers/Query/posts

    const r = api.getResolver('Query posts');
    r instanceof Resolver // => true
}

Documentation

Explore the documentation of AppSync Butler here.

/@appsync-butler/sst/

    Package Sidebar

    Install

    npm i @appsync-butler/sst

    Weekly Downloads

    2

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    17.1 kB

    Total Files

    22

    Last publish

    Collaborators

    • alichry