feat(adapter-dynamodb): extend schema options #11463
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change allows for more flexibility when customising the schema used by the DynamoDB adapter. Specifically, it adds the ability to customize:
index.test.ts
andformat.test.ts
were updated to reflect changes required to theformat.from
function.custom_config.test.ts
was added, which runs a full suite of the basic tests against both the existing customizations and those included in this PR.💻 Example
EntityTags
andEntitySlug
are both of typeDynamoDBEntityTypeOptions
and can take an (optional, string) value for each type of entity the adapter stores:EntitySlug
does not format the provided slugs in any way; If users wish to include a separator such as#
, they need to include it.☕️ Reasoning
Firstly, to increase the ability to integrate Auth.js with other systems. For instance , DynamoDBToolbox uses an attribute
_et
by default to type records.Secondly, to give users more control in general. They may wish to disambiguate AuthJS
User
items from some extantUser
entity, or shortenACCOUNT
toACNT
.Documentation was not added, as the documentation on the
🧢 Checklist