1.10.1 • Published 7 months ago
@aws-appsync/utils v1.10.1
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.10.1
7 months ago
1.10.0
8 months ago
1.9.0
11 months ago
1.8.0
1 year ago
1.7.0
1 year ago
1.6.0
2 years ago
1.2.6
2 years ago
1.5.0
2 years ago
1.3.1
2 years ago
1.3.0
2 years ago
1.2.5
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.0
2 years ago
1.2.1
2 years ago
1.1.0
2 years ago
1.0.1
3 years ago
1.0.0
3 years ago