Synchronizer
Uploads your Database
configuration to DynamoDB-Toolshack:
import { Synchronizer } from 'dynamodb-toolbox/database/actions/synchronize'
await pokeDB
.build(Synchronizer)
.awsAccount({
awsAccountId: '398259209128',
awsRegion: 'us-east-1'
})
.sync({ apiKey: '<YOUR_API_KEY_HERE>' })
Requestβ
.awsAccount(...)
β
(required)
Defines the AWS accountId
and region
associated with the Database
. You can optionally include metadata:
await PokeTable.build(Synchronizer)
.awsAccount({
awsAccountId: '398259209128',
awsRegion: 'us-east-1',
// π Optional metadata
title: 'Dev',
description: 'Development environment account',
// π https://ui.shadcn.com/colors
awsAccountColor: 'blue'
})
.sync(...)
Methodsβ
.sync(...)
β
Uploads the configuration to DynamoDB-Toolshack:
await PokeTable.build(Synchronizer)
.awsAccount(...)
.sync({
// π https://app.dynamodb-toolshack.com/api-keys
apiKey: '<API_KEY>',
// π (optional) Keep only specified entities (`false` by default)
deleteUnknownEntities: true,
})
Adding Metadataβ
Additional DynamoDB-Toolshack metadataβsuch as Table and Entity titles, descriptions, and iconsβcan be defined directly inside the meta
property of each Table and Entity.
Tableβ
Use the standard metadata fields to define a Tableβs title
and description
. You can customize the icon
and accessRole
attributes under the _ddbToolshack
key:
export const PokeTable = new Table({
...
meta: {
title: 'Pokedex',
description: 'An Awesome Table for development use',
_ddbToolshack: {
// π https://lucide.dev/icons/
icon: 'database-zap',
accessRole: {
roleName: 'DynamoDBToolshackAccountAccessRole',
description: 'Optional role description'
}
}
}
})
Entityβ
Use the standard metadata fields to define an Entity's title
and description
. You can customize the icon
attribute under the _ddbToolshack
key:
export const PokemonEntity = new Entity({
...
meta: {
title: 'Pokemon',
description: 'An Awesome Entity for development use',
_ddbToolshack: {
// π https://lucide.dev/icons/
icon: 'cat'
}
}
})