UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

14 lines (13 loc) 5.62 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Values=exports.AttributeValuesStep=exports.AttributeValues=exports.PartitionKey=exports.PrimaryKey=exports.SortKeyStep=exports.PartitionKeyStep=exports.Assign=exports.KeyCondition=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var private_1=()=>{var tmp=require("./private");return private_1=()=>tmp,tmp};class KeyCondition{cond;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.KeyCondition",version:"2.233.0"};static eq(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,"=",arg))}static lt(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,"<",arg))}static le(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,"<=",arg))}static gt(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,">",arg))}static ge(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,">=",arg))}static beginsWith(keyName,arg){return new KeyCondition(new(private_1()).BeginsWith(keyName,arg))}static between(keyName,arg1,arg2){return new KeyCondition(new(private_1()).Between(keyName,arg1,arg2))}constructor(cond){this.cond=cond}and(keyCond){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_KeyCondition(keyCond)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.and),error}return new KeyCondition(this.cond.and(keyCond.cond))}renderTemplate(){return`"query" : { "expression" : "${this.cond.renderCondition()}", "expressionNames" : { ${this.cond.renderExpressionNames()} }, "expressionValues" : { ${this.cond.renderExpressionValues()} } }`}}exports.KeyCondition=KeyCondition;class Assign{attr;arg;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.Assign",version:"2.233.0"};constructor(attr,arg){this.attr=attr,this.arg=arg}renderAsAssignment(){return`"${this.attr}" : $util.dynamodb.toDynamoDBJson(${this.arg})`}putInMap(map){return`$util.qr($${map}.put("${this.attr}", ${this.arg}))`}}exports.Assign=Assign;class PartitionKeyStep{key;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.PartitionKeyStep",version:"2.233.0"};constructor(key){this.key=key}is(val){return new PartitionKey(new Assign(this.key,`$ctx.args.${val}`))}auto(){return new PartitionKey(new Assign(this.key,"$util.autoId()"))}}exports.PartitionKeyStep=PartitionKeyStep;class SortKeyStep{pkey;skey;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.SortKeyStep",version:"2.233.0"};constructor(pkey,skey){this.pkey=pkey,this.skey=skey;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(pkey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SortKeyStep),error}}is(val){return new PrimaryKey(this.pkey,new Assign(this.skey,`$ctx.args.${val}`))}auto(){return new PrimaryKey(this.pkey,new Assign(this.skey,"$util.autoId()"))}}exports.SortKeyStep=SortKeyStep;class PrimaryKey{pkey;skey;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.PrimaryKey",version:"2.233.0"};static partition(key){return new PartitionKeyStep(key)}constructor(pkey,skey){this.pkey=pkey,this.skey=skey;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(pkey),jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(skey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,PrimaryKey),error}}renderTemplate(){const assignments=[this.pkey.renderAsAssignment()];return this.skey&&assignments.push(this.skey.renderAsAssignment()),`"key" : { ${assignments.join(",")} }`}}exports.PrimaryKey=PrimaryKey;class PartitionKey extends PrimaryKey{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.PartitionKey",version:"2.233.0"};constructor(pkey){super(pkey);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(pkey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,PartitionKey),error}}sort(key){return new SortKeyStep(this.pkey,key)}}exports.PartitionKey=PartitionKey;class AttributeValues{container;assignments;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.AttributeValues",version:"2.233.0"};constructor(container,assignments=[]){this.container=container,this.assignments=assignments}attribute(attr){return new AttributeValuesStep(attr,this.container,this.assignments)}renderVariables(){return`#set($input = ${this.container}) ${this.assignments.map(a=>a.putInMap("input")).join(` `)}`}renderTemplate(){return'"attributeValues": $util.dynamodb.toMapValuesJson($input)'}}exports.AttributeValues=AttributeValues;class AttributeValuesStep{attr;container;assignments;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.AttributeValuesStep",version:"2.233.0"};constructor(attr,container,assignments){this.attr=attr,this.container=container,this.assignments=assignments}is(val){return this.assignments.push(new Assign(this.attr,val)),new AttributeValues(this.container,this.assignments)}}exports.AttributeValuesStep=AttributeValuesStep;class Values{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.Values",version:"2.233.0"};static projecting(arg){return new AttributeValues("$ctx.args"+(arg?`.${arg}`:""))}static attribute(attr){return new AttributeValues("{}").attribute(attr)}}exports.Values=Values;