-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(adapter-dynamodb): extend schema options #11463
base: main
Are you sure you want to change the base?
Conversation
This change allows for more flexibility when customising the schema used by the DynamoDB adapter. Specifically, it adds the ability to customize: * **EntityTagName**: The attribute name under which to store the *type* of the entity. * **EntityTags**: The value to use for each Entity type for the above attribute. * **EntitySlugs**: The slug which is prepended to each type's partition/sort key. `EntityTags` and `EntitySlug` are both of type `DynamoDBEntityTypeOptions` and can take an (optional, string) value for each type of entity the adapter stores: ``` const entityTags: DynamoDBEntityTypeOptions = { user: "AUTHUSER", account: "ACT", session: "SES", vt: "VT" } ``` `EntitySlug` does not format the provided slugs in any way; If users wish to include a separator such as `#`, they need to include it. `index.test.ts` and `format.test.ts` were updated to reflect changes required to the `format.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.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@DylanLacey is attempting to deploy a commit to the authjs Team on Vercel. A member of the Team first needs to authorize it. |
It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks! |
Hey folks, this is still relevant; Is there something I can do to help make it easier to get a trial deployment run, besides updating to remove the merge conflicts? |
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
.🧢 Checklist