next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

feat(adapters): add `triplit` adapter

Open wernst opened this issue 1 year ago • 13 comments

This PR adds a db adapter for Triplit, a realtime database that runs on both the browser and server. We're big fans of next auth and have been using it internally for projects at Triplit, so are excited to make this adapter available to the public.

The code should work as is, however I'm running into two issues.

  1. I'm unable to get the tests running with jest and pnpm. I've done some configuring of jest on my end (not in this PR) to get around what appear to be some esm issues, but am having trouble resolving the @triplit/client package with pnpm. I'll keep fiddling, but if you have any ideas please let me know.
  2. I am unsure how documentation is generated. I have the content for the docs ready, but I'm unsure if its content is auto-generated or hand written.

Thank you for any guidance.

wernst avatar Jan 04 '24 22:01 wernst

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) Jul 18, 2024 5:51pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Jul 18, 2024 5:51pm

vercel[bot] avatar Jan 04 '24 22:01 vercel[bot]

@wernst is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 04 '24 22:01 vercel[bot]

@wernst thanks for the PR! I haven't looked closely so can't answer your first question yet, but the docs are mostly included as typedocs in the code as comments (in your triplit-adapter/src/index.ts for example). Check out the prisma adapter for an example 👍

ndom91 avatar Jan 05 '24 02:01 ndom91

@ndom91 Thanks for the info! Looks like the testing issues were related to a cjs/esm packaging issue in our js libs, so that should be resolvable on our end. I'll add the relevant typedocs comments as well.

wernst avatar Jan 05 '24 22:01 wernst

Hi @ndom91 , I just pushed up a commit adding the doc strings. The testing issue is also resolved. I'll let you take a look when you have a chance, but let me know if there's anything else I can be helpful with to merge the PR. Thanks for your time!

wernst avatar Jan 09 '24 18:01 wernst

Hi @ndom91 , I just pushed up a commit adding the doc strings. The testing issue is also resolved. I'll let you take a look when you have a chance, but let me know if there's anything else I can be helpful with to merge the PR. Thanks for your time!

Thanks @wernst! There do seem to be some merge conflicts atm, can you take a look at those? 🙏

ndom91 avatar Jan 10 '24 10:01 ndom91

@ndom91 My apologies! Just rebased the branch, so those conflicts in the lock file should be resolved now.

wernst avatar Jan 10 '24 17:01 wernst

Thanks, looking much better! I have a few more notes, mostly small repo organisation type stuff.

I'll just add them as a checklist here:

  • [ ] Add triplit to .github/pr-labeler.yml
  • [ ] Add triplit to .github/workflows/release.yml
  • [ ] Add triplit to docs/scripts/generate-manifest.mjs
  • [ ] Add a triplit icon to docs/static/img/adapters/triplit.svg
  • [ ] Add a README.md to packages/adapter-triplit/README.md (see other adapters for example)
  • [ ] Add triplit to the turborepo config (turbo.json)
  • [ ] package.json is missing exports map and a few other metadata fields that other adapters have (see other adapter / packages package.json's)

If you could take care of those, that'd be great! Also, if you haven't seen it yet, we have a guide for adding a new adapter which includes a lot of reminders / guidelines :pray:

ndom91 avatar Jan 14 '24 13:01 ndom91

@ndom91 Those updates should be in (if I missed anything my apologies). I did see there was one file (.github/ISSUE_TEMPLATE/3_bug_adapter.yml) that also looked like it had some references to adapters - let me know if I should add there as well.

wernst avatar Jan 16 '24 02:01 wernst

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

socket-security[bot] avatar Jan 22 '24 17:01 socket-security[bot]

Hi @ndom91 , just want to bump this one more time while I dont have a lock file conflict. Just switched over the test runner to vitest. The only outstanding question I have is whether I should edit: .github/ISSUE_TEMPLATE/3_bug_adapter.yml?

Thanks!

wernst avatar Feb 08 '24 20:02 wernst

@ndom91 just rebased onto main, so bumping this

wernst avatar Apr 24 '24 18:04 wernst

@ndom91 just rebased onto main, so bumping this

wernst avatar Jul 18 '24 17:07 wernst