
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
graphql-retain-transformer
Advanced tools
Prevent losing production data by enabling the retain deletion policy for your AWS Amplify API!
🚨 Prevent losing production data by enabling the retain deletion policy for your AWS Amplify API!
The GraphQL Retain transformer is a custom directive that you can install and use in your
AWS Amplify API schema. It will then set the DeletionPolicy
of the created DynamoDB
tables from the default Delete
to Retain
.
What this does is it will make sure that those resources and its contents are not getting removed during a stack deletion. The deletion process will run through successfully, but you can still find the old DynamoDB table in your AWS admin console.
Attention: If you create a new DynamoDB table with the exact same name, it will then overwrite the retained table and its data! So creating backups are still a good thing to do from time to time 😉
Read this blog post about this directive for more information: https://react-freelancer.ch/blog/amplify-retain-dynamodb-tables
npm install --save graphql-retain-transformer
For projects using the old GraphQL Transformer v1 run:
npm install --save graphql-retain-transformer@1
Edit amplify/backend/api/<YOUR_API>/transform.conf.json
and append "graphql-retain-transformer"
to the transformers
field.
"transformers": [
"graphql-retain-transformer"
]
Append @retain
to target types.
type Todo @model @retain {
id: ID!
title: String!
description: String
}
This custom directive just sets the DeletionPolicy
of the created DynamoDB tables from the default Delete
to Retain
.
Read more about the DeletionPolicy
in the AWS docs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
Contributions are more than welcome! I love how AWS Amplify helps us developers building great apps in a short time. That's why I'd like to give back with contributions like this. If you feel the same and would like to join me in this project it would be awesome to get in touch! 😊
Please feel free to create, comment and of course solve some of the issues. To get started you can also go for the easier issues marked with the good first issue
label if you like.
npm link
in the cloned project directory and npm link graphql-retain-transformer
in your test project where you want to use it. Maybe you'll have to uninstall the previously installed dependency as installed from NPM repository.npm start
in your cloned project directory. Every code change is now immediately used in your test project, so you can just modify code and test it using amplify codegen models
or amplify push
.Hint: It is important to always make sure the version of the installed graphql
dependency matches the graphql
version the graphql-transformer-core
depends on.
npm publish
.The MIT License
The graphql-retain-transformer library is maintained and sponsored by the Swiss web and mobile app development company Florian Gyger Software.
If this library saved you some time and money please consider sponsoring me, so I can build more libraries for free and actively maintain them for you. Thank you 🙏
FAQs
Prevent losing production data by enabling the retain deletion policy for your AWS Amplify API!
We found that graphql-retain-transformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.