Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: self-hosting improvements (#4310)
* improvements to Self Hosted Tina. (#4095) * inital improvments in self hosted * update database files * use createDatabaseInternal * fix type build * added changeset * use databaseClient * add file system bridge to createLocalDatabase * Update .changeset/great-seahorses-yell.md Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update .changeset/great-seahorses-yell.md Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update .changeset/great-seahorses-yell.md Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update .changeset/great-seahorses-yell.md Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update examples/tina-self-hosted-demo/pages/[filename].tsx Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * update backendClient to databaseClient * fix typo * move gitProvider interface to graphql package * add files * add more options to GithubProvider * Update types * update changeset * update changeset * move github provider to its own package * rename tinacms-provider-github to tinacms-gitprovider-github * Update packages/tinacms-gitprovider-github/README.md Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-gitprovider-github/README.md Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> --------- Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * feat: tinacms-next-auth + feat: self-hosted cli improvements (#4105) * feat: next-auth-tinacms package * update lockfile * fix build * change entrypoint to node and update typescript * downgrade typescript and next * update lock file * pin deps * remove @types/node * add bin * add bin wrapper * switch to clipanion and fix deps that were breaking executable * add isomorphic-fetch * create function for generating nextauth auth handler * change target * try not targeting node * revert target change * split out frontend code * add missing await * feat: add self-hosted init w/ refactoring of existing init * consistently use await * has -> exists; add gitignore checks to environment * refactor templates. Add next-auth-tinacms dependency * implement custom auth in config templates * generate auth.ts * add missing import for next auth * refactor generated files and add generated command handler interface * refactor files to match handler interface * generate nextauth api handler and further refactoring of generated files * implement register api handler generation * ensure generated file parent directory exists * generate database.ts * remove unused * fix logic to disable clientId, token questions * add missing changeset * misc bug fixes * generate .env and use it to save settings * rename next-auth integration * rename next-auth integration * generate gql endpoint * add github personal access token to config * fix name of client id * update lock file * initial version update * fix name of package in changeset * fix references to next-auth-tinacms * drop inquirer for auth cli in favor of prompts for consistency * update lock file * fix choice access * initialize tailwind and fix issue with contentApiUrlOverride not getting set * add missing comma * don't write global.css * fix logo generation; add debug params * add isLocal environment variable to dev script * fix prompt for nextauth provider * fix nextjs style resolution to handle '@' * add debug; fix path replace * override -> overwrite * try fixing path computation again * remove debug * make file output consistent * remove tailwind from regular deps * update database template to use new gitprovider stuff * update extendNextScripts to allow it to be run repeatedly * fix auth reference * fix to not redefine req.session * fix client request * add .env to gitignore * add ts-nocheck to ignore type errors in generated files * add defaults to fix type issues * try fix for `Could not find a declaration file for module '@tinacms/datalayer'` * add types to exports * add ts-nocheck to generated database client * refactor next templates; set correct client in generated post page dependent on whether data layer is enabled * quotes -> backticks * give meaningful names to generic types * pr feedback * pr feedback * detect next app dir and display error message if present * add short blurb to readme * use css modules to avoid adding / modifying tailwind * attempt to use tag version for dependencies * add cli version to environment * try dynamic require * parse version from command line args * debugging * make tinaVersion a cli argument * fix name of modules * fix generated css * add setup users script if kv provider enabled * Fix/base init (#4114) * remove question about env var names * add more context to final log message * update * update * update main in package.json * make branch consistent * update to use correct comment in css module * fix script * better error handling * update styles * and backend commit sub command * only add files in normal init or when the config is not present * remove unused code * generate the js code for the js client * only install deps if there are any * only set NEXTAUTH_CREDENTIALS_KEY in backend init * added changeset * ask to override files when doing backend init and self hosting * log out code sample of config update * fix typo * feat: ENG-1119: validate KV env vars * move code snipped to end * install next-tinacms-auth when the user enables it * fix typo and call function * Fix hasSelfHostedConfig calls which are a function instead of a property (#4148) * return apiUrl Correctly * Update packages/@tinacms/cli/src/cmds/init/apply.ts Co-authored-by: James O'Halloran <james.p.ohalloran@gmail.com> * Only write self hosted Env when self hosting * update logs at the end of init * update link * Update packages/@tinacms/cli/src/cmds/init/configure.ts * update text on backend init questions * remove typescript from generated files * fix issue where deps would not getting installed * Fix issues caused by the prompts being skipped when there's an existin config file * Add typescript property to api/gql endpoint generator * Make NEXTAUTH_CREDENTIALS_KEY optional (#4158) * feat: ENG-1116: stop generating .env.tina * fix typo * fix: missing call to request * fix: typo * Always ask for pacakge manager (#4162) * always ask for package manager * code cleanup * use package.json to see if tina deps are installed * fix adduser * Wrap up auth provider * rework to NextAuthProvider * use auth provider * add clerk provider package * use authHooks * fix tests * added changeset * fix: make the reactive example a GeneratedFile and prompt for overwrite during backend init * fix: type addReactiveFile function * Update index.tsx * typo * use src/pages instead of src when doing init (#4203) * Remove start script (#4207) * remove start script from extendNextScripts * update tests * feat: Tina nextauth integration (#4205) * feat: tina nextauth integration * fix: remove cli entrypoint * feat: improve styling of login form * make authHooks optional * feat: switch to per collection isAuthCollection attribute * refactor: determine password field using field type * fix: getToken return types * fix: bad import * feat: implement password form plugin * fix: set autoComplete off to hint to browser not to save the password * fix: remove cruft * fix: make name different than username * chore: update tina-lock * fix: check only for user object to determine if authenticated * feat: add support for updatePassword mutation * feat: UI for updating password * fix: self-hosted react app issues (following next & react upgrade) * fix: icon for password change * fix: styling of login * fix: clear dirty flag after update succeeds * add bcryptjs to package.json (#4208) * Remove ts-expect-errors (#4209) * add bcryptjs to package.json * remove ts-expect-errors * fix: async unmount issue when logging in * fix: react controlled input bug * fix: unmounting logic * feat: overhaul to use single doc collections for auth * feat: make auth provider params fully optional * fix: add null check for when a password field doesn't exist * fix: update snapshot * fix: provide defaults for password / id fields * fix: collection not getting passed to _indexContent * fix: explicitly set local auth provider * refactor: tinacms-next-auth -> tinacms-authjs * refactor: isIdentifier -> uid * feat: provide a default user collection * fix: remove unnecessary await * update lodash imports (#4217) * fix: null-safe authorize * fix: add checks in auth to verify id field and password field exist * fix: null-safe role check (take 2) * fix: hide password update in local mode * fix: double encoding on password change * fix: broken account menu logic * fix tests * fix: get error message from nextauth and display to user * fix: authenticate / authorize to not throw gql exception when normal auth failure occurs * feat: add namespace property to database to allow content to be namespaced by branch * make boilerplate easier to generate (#4221) * make boilerplate easier to generate * fix: authorization should check authorize is defined * fix: call authorize not request * fix: only require password field when authenticating * fix: add prop to specify the field on the jwt to use as uid * fix: add debug option and pass uid prop to session * fix: access authorize correctly --------- Co-authored-by: Logan Anderson <43075109+logan-anderson@users.noreply.github.com> Co-authored-by: Logan Anderson <landerson2@upei.ca> * feat: custom next-auth api endpoint path (#4233) * fix: wrong package directory * feat: support custom next-auth path (`/api/tina/auth/*`) to support consolidated api without rewrite * add node backend functions (#4231) * allow tinacms to be used in a single backend function * add changset * use older next version * use node APIs instead of nextjs * remove console log * use req and res of handler * update self-hosted example * Remove auth.js file * add local authentication * check user role * fix deps of tinacms-authjs * Rename isAuthenticated to isAuthorized and use proper status codes * update naming to be consistent * remove unused exports from tinacms-authjs * rename isAuthRequired to secure * move node.ts to backend/index.ts * export directly from datalayer package * fix: return promise from nextauth handler * fix: await instead of return * feat: warn nextauth custom provider (#4248) * feat: add warning when not using tina credentials provider with self-hosted backend * add WARNING prefix * Update self hosted init (#4264) * move prompts to typesafe helper functions * reorganize code to be fully typesafe * remove unused file * remove self hosted init command * update apply to write to [...routes] and use new database format * fix tinacms init issues * fix typos in generated files * fix typo in generated db file * use correct path for generated next api route * better organization of prompt code * remove unused code * ask about generated files * only add example on first time setup * install cli as a dev dep * log env vars * only add example on first time init * fix tina cloud auth example * fix generated config and install * format config file * add databaseAdapter imports to database file * fix error 'can not read properity name of undefined' * take into account using src dir when making the next api route * only ask to overwrite config file if we are not doing backend init * remove duplicated logic for tina cloud setup * update types * fix session provider types * fix: frontMatterFormat detection and type * install datalayer package when self hosting * make sure next-auth is installed when using authJs provider * remove tina cloud from list of auth providers * Add user collection to init (#4277) * do not ask for auth provider * add user collection to init process * add secure: true to gql endpoint (#4280) * feat: cli init update tina config (#4284) * feat: update cli backend init to update tina config instead of requiring manual update * update comment for visitor function * fix: comment out custom options for git provider and database adapter * fix: revert lockfile * fix: type error * update config codegen to use some of the config options instead of hard coding * add users/index.json file when doing init (#4287) * add users/index.json file when doing init * Update packages/@tinacms/cli/src/cmds/init/apply.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> --------- Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Fix clerk auth (#4286) * fix clerk auth to use the new auth pattern * update authorize and get user function * auth provider should be the users auth provider if provided (#4298) * fix: override name property on CredentialsProvider so warning message isn't erroneously shown (#4302) * fix clerk auth and add orgId (#4296) * fix clerk auth and add orgId * update * Update packages/tinacms-clerk/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-clerk/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-clerk/src/tinacms.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> --------- Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * refactor: authentication -> authProvider (#4291) * feat: prompt user for password change (#4299) * feat: prompt user for password change * fix: password form validation * fix: preserve existing password * fix: update tina lock * fix: type error * fix: static media * fix: errors can not be undefined (#4309) * fix: add @tinacms/auth to changeset * fix: typo * Backend improvements (#4306) * add backend improvments * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-authjs/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-authjs/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-authjs/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-authjs/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/tinacms-authjs/src/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * Update packages/@tinacms/datalayer/src/backend/index.ts Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> --------- Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * fix: add a default content namespace when one is not specified * fix: typo * fix generated users/index.json file (#4314) * fix: apply namespace to metadata * fix self hosted types (#4315) * fix self hosted types * update types * update types * export client from generated databse client (#4316) * fix: no redirect on logout & update mongodb-level (#4319) * fix: call onLogout & redirect only after logout returns * chore: update mongodb-level * fix logout() return type in DefaultAuthJSProvider * fix add async * Minor Improvements (#4324) * add small imporovments * create .env file if it does not exsist * add message about usnig the backend client * update message * typo * feat: move users collection to site section and change icon to users (#4323) * fix issues with generated config file (#4325) * fix issues with generated files (#4331) * update to use new version of upstash-redis-level (#4339) * consolidate all changesets into a single changeset (#4340) * Update examples/tina-self-hosted-demo/tina/config.tsx Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> * fix: namespace is now an optional argument to createDatabase (#4344) * fix: deprecated build.auth -> authProvider --------- Co-authored-by: Kelly Davis <kldavis4@users.noreply.github.com> Co-authored-by: Kelly Davis <kelly.davis@forestry.io> Co-authored-by: Jeff See <jeffsee.55@gmail.com> Co-authored-by: James O'Halloran <james.p.ohalloran@gmail.com>
- Loading branch information