1.7.0 • Published 3 months ago

@aws-appsync/utils v1.7.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
3 months ago

Type definition for @aws-appsync/utils

This project contains utility function definitions and type definitions for working with AWS AppSync Resolvers written in JavaScript using the APPSYNC_JS runtime. This includes the util and extensions utilities. For more information on these utilities, see the AppSync documentation.

Usage

Install the type definition by running

npm install @aws-appsync/utils

In your AppSync function code definition:

import { util } from '@aws-appsync/utils';
import * as ddb from '@aws-appsync/utils/dynamodb';

/**
 * Creates a new item in a DynamoDB table
 * @param ctx contextual information about the request
 */
export function request(ctx) {
  const item = ctx.arguments.input;
  return ddb.put({ key: { id: util.autoId() }, item });
}

/**
 * Returns the result
 * @param ctx contextual information about the request
 */
export function response(ctx) {
  const { error, result } = ctx;
  if (error) {
    return util.appendError(error.message, error.type, result);
  }
  return ctx.result;
}
1.7.0

3 months ago

1.6.0

6 months ago

1.2.6

9 months ago

1.5.0

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.0

1 year ago

1.2.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago