New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aws-appsync/utils

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-appsync/utils - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/dynamodb-utils.d.ts

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

# [1.2.0](https://github.com/aws/aws-appsync-toolkit/compare/v1.1.0...v1.2.0) (2023-03-31)
### Bug Fixes
- rename the DynamoDBGetItem to DynamoDBGetItemRequest ([#68](https://github.com/aws/aws-appsync-toolkit/issues/68)) ([09adf56](https://github.com/aws/aws-appsync-toolkit/commit/09adf566d8c0f3cbb258bc767aa11241ebdfce06))
- update order of generics ([#67](https://github.com/aws/aws-appsync-toolkit/issues/67)) ([cc74b50](https://github.com/aws/aws-appsync-toolkit/commit/cc74b502dc3d8603480f1d2af8098ee22356638d))
### Features
- add runtime namespace and declare globals ([9705388](https://github.com/aws/aws-appsync-toolkit/commit/9705388e4c055ec5f25684f5c946f8bd20f2df4b))
- add typedefinition to utils ([#73](https://github.com/aws/aws-appsync-toolkit/issues/73)) ([172455c](https://github.com/aws/aws-appsync-toolkit/commit/172455ccf8cd3413f441abeefd81612e16b78a5a))
- add typescript generic support to Context ([#56](https://github.com/aws/aws-appsync-toolkit/issues/56)) ([2ccb9b8](https://github.com/aws/aws-appsync-toolkit/commit/2ccb9b85d0333442e4ec34a6539f23f260421088))
# [1.1.0](https://github.com/aws/aws-appsync-toolkit/compare/v1.0.1...v1.1.0) (2023-01-31)

@@ -8,0 +21,0 @@

685

lib/index.d.ts
export * from './resolver-return-types';
import { DynamodbUtil } from './dynamodb-utils';
import { RdsUtil } from './rds-utils';
import { StringUtils } from './string-utils';
import { TimeUtils } from './time-utils';
import { HttpUtils } from './http-utils';
import { XmlUtils } from './xml-utils';
import { MathUtils } from './math-utils';
import { TransformUtils } from './transform-utils';
type SubscriptionInvalidationObject = {
subscriptionField: string;
payload: Record<string, any>;
};
/**
* The Util object contains general utility methods to help you work with data.
*/
type Util = {
export type Util = {
/**

@@ -104,3 +116,3 @@ * Returns the input string as a JavaScript escaped string.

*/
authType(): String;
authType(): string;
/**

@@ -112,3 +124,3 @@ * The `util.time` variable contains datetime methods to help generate timestamps, convert

*/
time: Time;
time: TimeUtils;
/**

@@ -120,3 +132,3 @@ * `util.dynamodb` contains helper methods that make it easier to write and read data to Amazon

*/
dynamodb: Dynamodb;
dynamodb: DynamodbUtil;
/**

@@ -126,3 +138,3 @@ * `util.rds` contains helper methods that makes it easier to write and read data from Amazon

*/
rds: Rds;
rds: RdsUtil;
/**

@@ -132,3 +144,3 @@ * The `util.http` utility provides helper methods that you can use to manage HTTP request

*/
http: Http;
http: HttpUtils;
/**

@@ -138,3 +150,3 @@ * `util.xml` contains helper methods that can make it easier to translate XML responses

*/
xml: Xml;
xml: XmlUtils;
/**

@@ -144,579 +156,21 @@ * `util.transform` contains helper methods that make it easier to perform complex operations

*/
transform: Transform;
transform: TransformUtils;
/**
* `util.math1 contains methods to help with common Math operations.
*/
math: Math;
math: MathUtils;
/**
* `util.str` contains methods to help with common String operations.
*/
str: String;
str: StringUtils;
};
type Time = {
type Context<TArgs extends Record<string, any> | unknown = any, TStash extends Record<string, any> = Record<string, any>, TPrev extends Record<string, any> | undefined = any, TSource extends Record<string, any> | undefined = any, TResult extends any = any> = {
/**
* Returns a String representation of UTC in ISO8601 format.
* @returns {string} - Current time formatted ISO8601
*/
nowISO8601(): string;
/**
* Returns the number of seconds from the epoch of 1970-01-01T00:00:00Z to now.
* @returns {number} - Current time in seconds
*/
nowEpochSeconds(): number;
/**
* Returns the number of milliseconds from the epoch of 1970-01-01T00:00:00Z to now.
* @returns {number} - Current time in milliseconds
*/
nowEpochMilliSeconds(): number;
/**
* Returns a string of the current timestamp in UTC using the specified format from a String
* input type.
* @param {string} formatString - Date format string
* @returns {string} - Current time formatted
*/
nowFormatted(formatString: string): string;
/**
* Returns a string of the current timestamp for a timezone using the specified format and
* timezone from String input types.
* @param {string} formatString - Date format string
* @param {string} timezone - Timezone
* @returns {string} - Current time formatted
*/
nowFormatted(formatString: string, timezone: string): string;
/**
* Parses a timestamp passed as a String, along with a format, and return the timestamp as
* milliseconds since epoch.
* @param {string} timestamp - Formatted timestamp
* @param {string} formatString - Date format string
* @returns {number} - Parsed time
*/
parseFormattedToEpochMilliSeconds(timestamp: string, formatString: string): number;
/**
* Parses a timestamp passed as a String, along with a format and time zone, and return the
* timestamp as milliseconds since epoch.
* @param {string} timestamp - Formatted timestamp
* @param {string} formatString - Date format string
* @param {string} timezone - Timezone
* @returns {number} - Parsed time
*/
parseFormattedToEpochMilliSeconds(timestamp: string, formatString: string, timezone: string): number;
/**
* Parses an ISO8601 timestamp, passed as a String, and return the timestamp as milliseconds
* since epoch.
* @param {string} timestamp - ISO 8601 timestamp
* @returns {number} - Parsed timestamp in milliseconds
*/
parseISO8601ToEpochMilliSeconds(timestamp: string): number;
/**
* Converts an epoch milliseconds timestamp to an epoch seconds timestamp.
* @param {number} milliseconds - Milliseconds since epoch
* @returns {number} - Seconds since epoch
*/
epochMilliSecondsToSeconds(milliseconds: number): number;
/**
* Converts a epoch milliseconds timestamp to an ISO8601 timestamp.
* @param {number} milliseconds - Milliseconds since epoch
* @returns {string} - Date in ISO 8601 format
*/
epochMilliSecondsToISO8601(milliseconds: number): string;
/**
* Converts a epoch milliseconds timestamp, passed as long, to a timestamp formatted according
* to the supplied format in UTC.
* @param {number} milliseconds - Milliseconds since epoch
* @param {string} formatString - Date format string
* @returns {string} - Formatted timestamp
*/
epochMilliSecondsToFormatted(milliseconds: number, formatString: string): string;
/**
* Converts a epoch milliseconds timestamp, passed as long, to a timestamp formatted according
* to the supplied format in UTC.
* @param {number} milliseconds - Milliseconds since epoch
* @param {string} formatString - Date format string
* @param {string} timezone - Timezone
* @returns {string} - Formatted timestamp
*/
epochMilliSecondsToFormatted(milliseconds: number, formatString: string, timezone: string): string;
};
type Dynamodb = {
/**
* General object conversion tool for DynamoDB that converts input objects to the appropriate
* DynamoDB representation. It's opinionated about how it represents some types: e.g., it will
* use lists ("L") rather than sets ("SS", "NS", "BS"). This returns an object that describes
* the DynamoDB attribute value.
*
* String example:
* ```
* Input: util.dynamodb.toDynamoDB("foo")
* Output: { "S" : "foo" }
* ```
*
* Object example:
* ```
* Input: util.dynamodb.toDynamoDB({ "foo": "bar", "baz" : 1234, "beep": [ "boop"] })
* Output: {
* "M" : {
* "foo" : { "S" : "bar" },
* "baz" : { "N" : 1234 },
* "beep" : {
* "L" : [
* { "S" : "boop" }
* ]
* }
* }
* }
* ```
* @param {any} obj - Object to convert to DynamoDB attribute value
* @returns {any} - Object that describes DynamoDB attribute value
*/
toDynamoDB(obj: any): any;
/**
* Convert an input string to the DynamoDB string format. This returns an object that describes
* the DynamoDB attribute value.
* @param {any} obj Object to convert to DynamoDB attribute value
* @returns {string} - DynamoDB attribute object as string
*/
toString(obj: any): string;
/**
* Converts a lists with Strings to the DynamoDB string set format. This returns an object that
* describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toStringSet([ "foo", "bar", "baz" ])
* Output: { "SS" : [ "foo", "bar", "baz" ] }
* ```
* @param list - List to convert to DynamoDB attribute value
* @returns {any} - DynamoDB attribute object
*/
toStringSet(list: string[]): any;
/**
* Converts a number to the DynamoDB number format. This returns an object that describes the
* DynamoDB attribute value.
* ```
* Input: util.dynamodb.toNumber(12345)
* Output: { "N" : 12345 }
* ```
* @param {number} num - Number to convert to DynamoDB attribute value
* @returns {any} - DynamoDB attribute object
*/
toNumber(num: number): any;
/**
* Converts a list of numbers to the DynamoDB number set format. This returns an object that
* describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toNumberSet([ 1, 23, 4.56 ])
* Output: { "NS" : [ 1, 23, 4.56 ] }
* ```
* @param {number[]} numbers - Numbers to convert to DynamoDB number set
* @returns {any} - DynamoDB attribute object
*/
toNumberSet(numbers: number[]): any;
/**
* Converts binary data encoded as a base64 string to DynamoDB binary format. This returns an
* object that describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toBinary("foo")
* Output: { "B" : "foo" }
* ```
* @param {string} value - Base64 encoded string
* @returns {any} - DynamoDB attribute object
*/
toBinary(value: string): any;
/**
* Converts a list of binary data encoded as base64 strings to DynamoDB binary set format. This
* returns an object that describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toBinarySet([ "foo", "bar", "baz" ])
* Output: { "BS" : [ "foo", "bar", "baz" ] }
* ```
* @param {string[]} values - Base64 encoded string array
* @returns {any} - DynamoDB attribute object
*/
toBinarySet(values: string[]): any;
/**
* Converts a Boolean to the appropriate DynamoDB Boolean format. This returns an object that
* describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toBoolean(true)
* Output: { "BOOL" : true }
* ```
* @param {boolean} value - value to convert to DynamoDB attribute
* @returns {any} - DynamoDB attribute object
*/
toBoolean(value: boolean): any;
/**
* Converts a Boolean to the appropriate DynamoDB Boolean format. This returns an object that
* describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toNull()
* Output: { "NULL" : null }
* ```
* @returns {any} - DynamoDB attribute object
*/
toNull(): any;
/**
* Converts a list of object to DynamoDB list format. Each item in the list is also converted
* to its appropriate DynamoDB format. It's opinionated about how it represents some of the
* nested objects: e.g., it will use lists ("L") rather than sets ("SS", "NS", "BS"). This
* returns an object that describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toList([ "foo", 123, { "bar" : "baz" } ])
* Output: {
* "L" : [
* { "S" : "foo" },
* { "N" : 123 },
* {
* "M" : {
* "bar" : { "S" : "baz" }
* }
* }
* ]
* }
* ```
* @param {any[]} value - value to convert to DynamoDB attribute
* @returns {any} - DynamoDB attribute object
*/
toList(value: any[]): any;
/**
* Converts a map to DynamoDB map format. Each value in the map is also converted to its
* appropriate DynamoDB format. It's opinionated about how it represents some of the nested
* objects: e.g., it will use lists ("L") rather than sets ("SS", "NS", "BS"). This returns
* an object that describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toMap({ "foo": "bar", "baz" : 1234, "beep": [ "boop"] })
* Output: {
* "M" : {
* "foo" : { "S" : "bar" },
* "baz" : { "N" : 1234 },
* "beep" : {
* "L" : [
* { "S" : "boop" }
* ]
* }
* }
* }
* ```
* @param {any} value - value to convert to DynamoDB attribute
* @returns {any} - DynamoDB attribute object
*/
toMap(value: any): any;
/**
* Creates a copy of the map where each value has been converted to its appropriate DynamoDB
* format. It's opinionated about how it represents some of the nested objects: e.g., it will
* use lists ("L") rather than sets ("SS", "NS", "BS").
* ```
* Input: util.dynamodb.toMapValues({ "foo": "bar", "baz" : 1234, "beep": [ "boop"] })
* Output: {
* "foo" : { "S" : "bar" },
* "baz" : { "N" : 1234 },
* "beep" : {
* "L" : [
* { "S" : "boop" }
* ]
* }
* }
* ```
* Note: this is slightly different to `util.dynamodb.toMap(Map)` as it returns only the
* contents of the DynamoDB attribute value, but not the whole attribute value itself. For
* example, the following statements are exactly the same:
* ```
* util.dynamodb.toMapValues(obj)
* util.dynamodb.toMap(obj)["M"]
* ```
*
* @param {any} value - value to convert to DynamoDB attribute
* @returns {any} - DynamoDB attribute object
*/
toMapValues(value: any): any;
/**
* Converts the key, bucket and region into the DynamoDB S3 Object representation. This returns
* an object that describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toS3Object("foo", "bar", "baz")
* Output: { "S" : "{ \"s3\" : { \"key\" : \"foo", \"bucket\" : \"bar", \"region\" : \"baz" } }" }
* ```
* @param {string} key - S3 object key
* @param {string} bucket - S3 bucket
* @param {string} region - AWS Region
* @returns {any} - DynamoDB attribute object
*/
toS3Object(key: string, bucket: string, region: string): any;
/**
* Converts the key, bucket, region and optional version into the DynamoDB S3 Object
* representation. This returns an object that describes the DynamoDB attribute value.
* ```
* Input: util.dynamodb.toS3Object("foo", "bar", "baz", "beep")
* Output: { "S" : "{ \"s3\" : { \"key\" : \"foo\", \"bucket\" : \"bar\", \"region\" : \"baz\", \"version\" = \"beep\" } }" }
* ```
* @param {string} key - S3 object key
* @param {string} bucket - S3 bucket
* @param {string} region - AWS Region
* @param {string} version - S3 object version
* @returns {any} - DynamoDB attribute object
*/
toS3Object(key: string, bucket: string, region: string, version: string): any;
/**
* Accepts the string value of a DynamoDB S3 Object and returns a map that contains the key,
* bucket, region and optional version.
* @param s3ObjectString S3 object key
* @returns {any} DynamoDB attribute object
*/
fromS3ObjectJson(s3ObjectString: string): any;
};
type Rds = {
/**
* This is the same as `util.rds.toJsonString`, but with the result being a JSON Object.
* @param searializedSQLResult - Serialized SQL result
* @returns {any} - Object representing SQL results
*/
toJsonObject(searializedSQLResult: string): any;
};
type Http = {
/**
* Copies the header from the map without the restricted set of HTTP headers. You can use this
* to forward request headers to your downstream HTTP endpoint.
* @param {any} headers - Headers object
* @returns {any} - Copy of headers minus restricted HTTP headers
*/
copyHeaders(headers: any): any;
/**
* Adds a single custom header with the name (String) and value (Object) of the response. The
* following limitations apply:
* * Header names can't match any of the existing or restricted AWS or AWS AppSync headers.
* * Header names can't start with restricted prefixes, such as `x-amzn-` or `x-amz-`.
* * The size of custom response headers can't exceed 4 KB. This includes header names and values.
* * You should define each response header once per GraphQL operation. However, if you define a
* custom header with the same name multiple times, the most recent definition appears in the
* response. All headers count towards the header size limit regardless of naming
* ```
* util.http.addResponseHeader("itemsCount", 7)
* util.http.addResponseHeader("render", context.args.render)
* ```
* @param {string} name - Header name
* @param {any} value - Header value
*/
addResponseHeader(name: string, value: any): void;
/**
* Adds multiple response headers to the response from the specified map of names (String) and
* values (Object). The same limitations listed for the addResponseHeader(String, Object) method
* also apply to this method.
* ```
* const headersMap = {headerInt: 12, headerString: 'stringValue', headerObject: {field1: 7, field2: 'string'}}
* util.http.addResponseHeaders(headersMap)
* ```
* @param {any} headers - Headers map
*/
addResponseHeaders(headers: any): void;
};
type Xml = {
/**
* Converts an XML string to a Dictionary.
* ```
* Input:
*
* <?xml version="1.0" encoding="UTF-8"?>
* <posts>
* <post>
* <id>1</id>
* <title>Getting started with GraphQL</title>
* </post>
* </posts>
*
* Output (JSON representation):
*
* {
* "posts":{
* "post":{
* "id":1,
* "title":"Getting started with GraphQL"
* }
* }
* }
* ```
* @param {string} xml - XML string
* @returns {any} - Object representation of XML
*/
toMap(xml: string): any;
/**
* Converts an XML string to a JSON string. This is similar to toMap, except that the output is
* a string. This is useful if you want to directly convert and return the XML response from an
* HTTP object to JSON.
* @param {string} xml - XML string
* @returns {string} - JSON representation of XML
*/
toJsonString(xml: string): String;
/**
* Converts an XML string to a JSON string with an optional Boolean parameter to determine if
* you want to string-encode the JSON.
* @param {string} xml - XML string
* @returns {string} - String encoded JSON representation of XML
*/
toJsonString(xml: string, stringEncode: boolean): String;
};
type Transform = {
/**
* Converts an input string to a filter expression for use with DynamoDB.
* ```
* Input:
* util.transform.toDynamoDBFilterExpression({
* "title":{
* "contains":"Hello World"
* }
* })
*
* Output:
*
* {
* "expression" : "contains(#title, :title_contains)"
* "expressionNames" : {
* "#title" : "title",
* },
* "expressionValues" : {
* ":title_contains" : { "S" : "Hello World" }
* },
* }
* ```
* @param {any} filterObject - Object representing DynamoDB filter
* @returns {any} - DynamoDB filter expression object
*/
toDynamoDBFilterExpression(filterObject: any): any;
/**
* Converts the given input into its equivalent DynamoDB condition expression, returning it as a Json string.
*
* The default Operator is assumed to be `AND`. The method behaves similarly as toDynamoDBFilterExpression, except
* that it supports the remaining method that Dynamo condition expression supports, such as size, attribute_exists.
* @param {any} conditionObject Object representing DynamoDB condition
* @returns string the evaluated DynamoDB condition
*/
toDynamoDBConditionExpression(conditionObject: any): string;
/**
* Converts the given input into its equivalent OpenSearch Query DSL expression, returning it
* as a JSON string.
* ```
* Input:
*
* util.transform.toElasticsearchQueryDSL({
* "upvotes":{
* "ne":15,
* "range":[
* 10,
* 20
* ]
* },
* "title":{
* "eq":"hihihi",
* "wildcard":"h*i"
* }
* })
*
* Output:
* {
* "bool":{
* "must":[
* {
* "bool":{
* "must":[
* {
* "bool":{
* "must_not":{
* "term":{
* "upvotes":15
* }
* }
* }
* },
* {
* "range":{
* "upvotes":{
* "gte":10,
* "lte":20
* }
* }
* }
* ]
* }
* },
* {
* "bool":{
* "must":[
* {
* "term":{
* "title":"hihihi"
* }
* },
* {
* "wildcard":{
* "title":"h*i"
* }
* }
* ]
* }
* }
* ]
* }
* }
* ```
* The default operator is assumed to be AND.
* @param {any} obj - Object representing OpenSearch Query
* @returns {any} - OpenSearch Query DSL expression
*/
toElasticsearchQueryDSL(obj: any): any;
/**
* Converts a Map input object to a `SubscriptionFilter` expression object. The
* `util.transform.toSubscriptionFilter` method is used as an input to the
* `extensions.setSubscriptionFilter()` extension. For more information, see Extensions.
* @param {any} obj - Object representing subscription filter
* @returns {any} Subscription Filter expression object
*/
toSubscriptionFilter(obj: any): any;
/**
* Converts a Map input object to a `SubscriptionFilter` expression object. The
* `util.transform.toSubscriptionFilter` method is used as an input to the
* `extensions.setSubscriptionFilter()` extension. For more information, see Extensions.
*
* The first argument is the Map input object that's converted to the `SubscriptionFilter`
* expression object. The second argument is a List of field names that are ignored in the first
* Map input object while constructing the `SubscriptionFilter` expression object.
* @param {any} obj - Object representing subscription filter
* @param {string[]} ignoredFields - Fields to ignore in filter expression
* @returns {any} Subscription Filter expression object
*/
toSubscriptionFilter(obj: any, ignoredFields: string[]): any;
/**
* Converts a Map input object to a `SubscriptionFilter` expression object. The
* `util.transform.toSubscriptionFilter` method is used as an input to the
* `extensions.setSubscriptionFilter()` extension. For more information, see Extensions.
*
* The first argument is the Map input object that's converted to the `SubscriptionFilter`
* expression object, the second argument is a List of field names that will be ignored in the
* first Map input object, and the third argument is a Map input object of strict rules that's
* included while constructing the `SubscriptionFilter` expression object. These strict rules are
* included in the `SubscriptionFilter` expression object in such a way that at least one of the
* rules will be satisfied to pass the subscription filter.
* @param {any} obj - Object representing subscription filter
* @param {string[]} ignoredFields - Fields to ignore in filter expression
* @param {any} rules - Strict rules
* @returns {any} Subscription Filter expression object
*/
toSubscriptionFilter(obj: any, ignoredFields: string[], rules: any): any;
};
type String = {
/**
* Normalizes a string using one of the four unicode normalization forms: NFC, NFD, NFKC, or
* NFKD. The first argument is the string to normalize. The second argument is either "nfc",
* "nfd", "nfkc", or "nfkd" specifying the normalization type to use for the normalization
* process.
* @param {string} value - Value to be normalized
* @param {string} normalizationType - Normalization type
* @returns {string} - Normalized string
*/
normalize(value: string, normalizationType: string): string;
};
type Context = {
/**
* A map that contains all GraphQL arguments for this field.
*/
arguments: any;
arguments: TArgs;
/**
* A map that contains all GraphQL arguments for this field.
*/
args: any;
args: TArgs;
/**

@@ -730,3 +184,3 @@ * An object that contains information about the caller. For more information about the

*/
source: any;
source?: TSource;
/**

@@ -752,3 +206,3 @@ * Contains potential error generated by a request.

*/
stash: any;
stash: TStash;
/**

@@ -798,3 +252,3 @@ * A container for the results of this resolver. This field is available only to response

*/
result: any;
result: TResult;
/**

@@ -812,3 +266,3 @@ * The result of whatever previous operation was executed in a pipeline resolver. If the

*/
prev: any;
prev: TPrev;
/**

@@ -826,4 +280,4 @@ * AWS AppSync supports passing custom headers from clients and accessing them in your GraphQL

};
type Identity = AppSyncIdentityIAM | AppSyncIdentityCognito | AppSyncIdentityOIDC | AppSyncIdentityLambda | undefined | null;
type AppSyncIdentityIAM = {
export type Identity = AppSyncIdentityIAM | AppSyncIdentityCognito | AppSyncIdentityOIDC | AppSyncIdentityLambda | undefined | null;
export type AppSyncIdentityIAM = {
/**

@@ -871,3 +325,3 @@ * The AWS account ID of the caller.

};
type AppSyncIdentityCognito = {
export type AppSyncIdentityCognito = {
/**

@@ -910,3 +364,3 @@ * The source IP address of the caller that AWS AppSync receives. If the request doesn't

};
type AppSyncIdentityOIDC = {
export type AppSyncIdentityOIDC = {
/**

@@ -925,3 +379,3 @@ * The UUID of the authenticated user.

};
type AppSyncIdentityLambda = {
export type AppSyncIdentityLambda = {
/**

@@ -933,3 +387,3 @@ * content returned by the Lambda function authorizing the request.

type SubscriptionFilterValue = string | number;
interface SubscriptionFilterGeneric {
export interface SubscriptionFilterGeneric {
fieldName: string;

@@ -939,34 +393,34 @@ operator: string;

}
interface SubscriptionFilterEquality extends SubscriptionFilterGeneric {
export interface SubscriptionFilterEquality extends SubscriptionFilterGeneric {
operator: 'eq' | 'ne';
value: SubscriptionFilterValue | boolean;
}
interface SubscriptionFilterComparator extends SubscriptionFilterGeneric {
export interface SubscriptionFilterComparator extends SubscriptionFilterGeneric {
operator: 'le' | 'lt' | 'ge' | 'gt';
value: SubscriptionFilterValue;
}
interface SubscriptionFilterContains extends SubscriptionFilterGeneric {
export interface SubscriptionFilterContains extends SubscriptionFilterGeneric {
operator: 'contains' | 'notContains';
value: SubscriptionFilterValue;
}
interface SubscriptionFilterBeginsWith extends SubscriptionFilterGeneric {
export interface SubscriptionFilterBeginsWith extends SubscriptionFilterGeneric {
operator: 'beginsWith';
value: string;
}
interface SubscriptionFilterIn extends SubscriptionFilterGeneric {
export interface SubscriptionFilterIn extends SubscriptionFilterGeneric {
operator: 'in' | 'notIn';
value: SubscriptionFilterValue[];
}
interface SubscriptionFilterBetween extends SubscriptionFilterGeneric {
export interface SubscriptionFilterBetween extends SubscriptionFilterGeneric {
operator: 'between';
value: [SubscriptionFilterValue, SubscriptionFilterValue];
}
type SubscriptionFilterEntry = SubscriptionFilterEquality | SubscriptionFilterComparator | SubscriptionFilterContains | SubscriptionFilterBeginsWith | SubscriptionFilterIn | SubscriptionFilterBetween;
type SubscriptionFilterGroup = {
export type SubscriptionFilterEntry = SubscriptionFilterEquality | SubscriptionFilterComparator | SubscriptionFilterContains | SubscriptionFilterBeginsWith | SubscriptionFilterIn | SubscriptionFilterBetween;
export type SubscriptionFilterGroup = {
filters: SubscriptionFilterEntry[];
};
type SubscriptionFilter = {
export type SubscriptionFilter = {
filterGroup: SubscriptionFilterGroup[];
};
type Extensions = {
export type Extensions = {
/**

@@ -994,4 +448,16 @@ * Evicts an item from the AWS AppSync server-side cache. The first argument is the type name.

setSubscriptionInvalidationFilter(filter: SubscriptionFilter): void;
/**
* Used to initiate a subscription invalidation from a mutation.
*
* The InvalidationObject defines the following:
* * subscriptionField – The GraphQL schema subscription to invalidate. A single subscription,
* defined as a string in the subscriptionField, is considered for invalidation.
* * payload – A key-value pair list that's used as the input for invalidating subscriptions
* if the invalidation filter evaluates to true against their values.
*
* @param obj
*/
invalidateSubscriptions(obj: SubscriptionInvalidationObject): void;
};
type Request = {
export type Request = {
/**

@@ -1008,5 +474,5 @@ * AWS AppSync supports passing custom headers from clients and accessing them in your GraphQL

*/
domainName: string;
domainName: string | null;
};
type Info = {
export type Info = {
/**

@@ -1023,3 +489,3 @@ * The name of the field that is currently being resolved.

*/
variables: any;
variables: Record<string, any>;
/**

@@ -1038,5 +504,32 @@ * A list representation of the fields in the GraphQL selection set. Fields that are aliased

};
/**
* The runtime object provides information and control over the current execution AppSync function
* or resolver.
*/
type Runtime = {
/**
* Invoking this function will halt execution of the current function (AppSync Function) or
* resolver (Unit or Pipeline Resolver) depending on the current context and return the specified
* object as the result.
* * When called in an AppSync function request handler, the data Source and response handler
* are skipped and the next function request handler (or the pipeline resolver response
* handler if this was the last AppSync function) is called.
* * When called in an AppSync pipeline resolver request handler, the pipeline execution is
* skipped, and the pipeline resolver response handler is called immediately.
*
* @param obj Optional return value
*/
earlyReturn(obj?: unknown): never;
};
declare global {
var util: Util;
var extensions: Extensions;
var runtime: Runtime;
}
declare const util: Util;
declare const extensions: Extensions;
export { util, extensions, Context };
declare const runtime: Runtime;
export { DynamoDBBinaryResult, DynamoDBBooleanResult, DynamoDBBinarySetResult, DynamoDBListResult, DynamoDBMapResult, DynamoDBNullResult, DynamoDBNumberResult, DynamoDBNumberSetResult, DynamoDBStringResult, DynamoDBStringSetResult, DynamoDBReturnType, } from './dynamodb-utils';
export { FilterJsonObjectResult, DynamoDBExpressionOperation, DynamoDBFilterObject, OpenSearchQueryObject, OpenSearchQueryOperation, ShallowSubscriptionFilterObject, SubscriptionFilterExcludeKeysType, SubscriptionFilterObject, SubscriptionFilterOperation, SubscriptionFilterRuleObject, } from './transform-utils';
export { util, extensions, runtime, Context };
//# sourceMappingURL=index.d.ts.map

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.extensions = exports.util = void 0;
exports.runtime = exports.extensions = exports.util = void 0;
__exportStar(require("./resolver-return-types"), exports);

@@ -24,2 +24,4 @@ const util = {};

exports.extensions = extensions;
const runtime = {};
exports.runtime = runtime;
//# sourceMappingURL=index.js.map

@@ -45,7 +45,16 @@ export type Key = {

};
export type DynamoDBGetItem = {
export type DynamoDBProjectionExpression = {
expression: string;
expressionNames?: Record<string, string>;
};
export type DynamoDBGetItemRequest = {
operation: 'GetItem';
key: Key;
consistentRead?: ConsistentRead;
projection?: DynamoDBProjectionExpression;
};
/**
* @deprecated Use DynamoDBGetItemRequest
*/
export type DynamoDBGetItem = DynamoDBGetItemRequest;
export type DynamoDBPutItemRequest = {

@@ -87,2 +96,3 @@ operation: 'PutItem';

filter?: DynamoDBExpression;
projection?: DynamoDBProjectionExpression;
};

@@ -98,2 +108,3 @@ export type DynamoDBScanRequest = {

filter?: DynamoDBExpression;
projection?: DynamoDBProjectionExpression;
};

@@ -117,2 +128,3 @@ export type DynamoDBSyncRequest = {

};
projection?: DynamoDBProjectionExpression;
};

@@ -119,0 +131,0 @@ export type DynamoDBBatchDeleteItemRequest = {

{
"name": "@aws-appsync/utils",
"version": "1.1.0",
"version": "1.2.0",
"description": "This project contains type definitions for AppSync resolver types.",

@@ -19,2 +19,3 @@ "main": "lib/index.js",

"devDependencies": {
"tsd": "^0.25.0",
"typescript": "^4.8.4"

@@ -25,5 +26,8 @@ },

"build": "tsc",
"test": "echo \"No tests\""
"test": "tsd"
},
"gitHead": "69a356912aa5e6f41a615fb5a858f8d270483218"
"tsd": {
"directory": "tests-d"
},
"gitHead": "030b7d3ae326f0c00c69a5f16d79c21eeb93a498"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc