Skip to content

Instantly share code, notes, and snippets.

@kayuapi
kayuapi / tsast2lambdas.ts
Created May 22, 2021 05:50 — forked from oldrev/tsast2lambdas.ts
Typescript Expression Tree to Lambda Expression
function visitAndExpression(exprNode: any): any {
const conditions = exprNode.expressions.map(function (expr: any) { return visitExpression(expr) })
return function (it: any) { return conditions.every(function (c: any) { return c(it) }) }
}
function visitOrExpression(exprNode: any): any {
const conditions = exprNode.expressions.map(function (expr: any) { return visitExpression(expr) })
@kayuapi
kayuapi / modifyAmplifyCF.js
Created July 21, 2020 11:55 — forked from hisham/modifyAmplifyCF.js
Modify Amplify CLI Generated Cloudformation File to Support a GraphQL Interface
/**
* Example script to change amplify cli-generated cloudformation stack to support a graphql interface. See https://github.com/aws-amplify/amplify-cli/issues/202.
* Run this before every amplify push command (e.g. create your own bash script that does something like: amplify api gql-compile && node ./scripts/modifyAmplifyCF.js && ./amplify/backend/api/<your_app_name>/build/cloudformtion-template.json && amplify push --no-gql-override)
* Everytime you run amplify api gql-compile, the cloudformation files will be overwritten and this script would need to be run again.
*
* As an example for this script, it assumes you have a custom User table built (through custom stacks - User.json for the AppSync resolvers and UserTable.json for the dynamodb table) and a Doctor and Patient model that implement this interface, e.g.
*
* interface User {
* id: ID!
*. email: AWSEmail!