Skip to content
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

New id fields #5947

Merged
merged 35 commits into from
Jun 29, 2021
Merged

New id fields #5947

merged 35 commits into from
Jun 29, 2021

Conversation

emmatown
Copy link
Member

@emmatown emmatown commented Jun 22, 2021

This replaces the idField option accepting regular field types to an object that can specify cuids, uuids or autoincrements. The default is now cuid instead of autoincrement

@changeset-bot
Copy link

changeset-bot bot commented Jun 22, 2021

🦋 Changeset detected

Latest commit: 61fa311

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@keystone-next/keystone Major
@keystone-next/types Major
@keystone-next/benchmarks-legacy Patch
@keystone-next/example-blog Patch
@keystone-next/example-default-values Patch
@keystone-next/example-document-field Patch
@keystone-next/example-extend-graphql-schema Patch
@keystone-next/example-json-field Patch
@keystone-next/example-task-manager Patch
@keystone-next/example-testing Patch
@keystone-next/example-virtual-field Patch
@keystone-next/example-with-auth Patch
@keystone-next/example-assets-cloud Patch
@keystone-next/example-assets-local Patch
@keystone-next/example-auth Patch
@keystone-next/examples-app-basic Patch
@keystone-next/example-ecommerce Patch
@keystone-next/example-embedded-nextjs Patch
keystone-next-app Patch
@keystone-next/example-playground Patch
@keystone-next/example-roles Patch
@keystone-next/example-sandbox Patch
@keystone-next/auth Major
@keystone-next/fields-document Patch
@keystone-next/fields Patch
@keystone-next/testing Patch
@keystone-next/api-tests-legacy Patch
@keystone-next/admin-ui-utils Patch
@keystone-next/cloudinary Patch
@keystone-next/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 22, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/9gLvjGKny4Gkg3Z1A9TeRYnanpwb
✅ Preview: https://keystone-next-docs-git-id-field-experimenting-keystonejs.vercel.app

@vercel vercel bot temporarily deployed to Preview June 22, 2021 00:43 Inactive
@vercel vercel bot temporarily deployed to Preview June 22, 2021 00:48 Inactive
@vercel vercel bot temporarily deployed to Preview June 22, 2021 03:26 Inactive
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 22, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@vercel vercel bot temporarily deployed to Preview June 22, 2021 03:41 Inactive
@gautamsi
Copy link
Member

Can we have id field config globally in keystone config?

I am thinking we would also want to map it for provider, once mongodb is there we can have mongoid or dbgenerated option.

@vercel vercel bot temporarily deployed to Preview June 24, 2021 02:12 Inactive
@vercel vercel bot temporarily deployed to Preview June 24, 2021 02:16 Inactive
@vercel vercel bot temporarily deployed to Preview June 25, 2021 01:23 Inactive
@vercel vercel bot temporarily deployed to Preview June 25, 2021 02:21 Inactive
@vercel vercel bot temporarily deployed to Preview June 25, 2021 03:42 Inactive
@vercel vercel bot temporarily deployed to Preview June 25, 2021 03:44 Inactive
@vercel vercel bot temporarily deployed to Preview June 25, 2021 03:58 Inactive
@vercel vercel bot temporarily deployed to Preview – keystone-next-docs June 25, 2021 04:45 Inactive
@emmatown emmatown marked this pull request as draft June 28, 2021 01:26
@vercel vercel bot temporarily deployed to Preview June 28, 2021 01:29 Inactive
// isCuid is just "it's a string and it starts with c"
// https://github.com/ericelliott/cuid/blob/215b27bdb78d3400d4225a4eeecb3b71891a5f6f/index.js#L69-L73
if (typeof val === 'string' && isCuid(val)) {
return val;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note not lower-casing here is a difference from what we discussed. My thinking is that isCuid only accepts strings that with c(as in only lower-case c) so treating it as case insensitive seems strange.

@emmatown emmatown marked this pull request as ready for review June 28, 2021 01:38
@emmatown emmatown requested a review from timleslie June 28, 2021 01:38
@vercel vercel bot temporarily deployed to Preview June 28, 2021 01:39 Inactive
Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
@vercel vercel bot temporarily deployed to Preview June 28, 2021 02:31 Inactive
Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
@vercel vercel bot temporarily deployed to Preview June 28, 2021 02:35 Inactive
@vercel vercel bot temporarily deployed to Preview June 28, 2021 02:45 Inactive
Copy link
Contributor

@timleslie timleslie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 pending changeset update.

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
@vercel vercel bot temporarily deployed to Preview June 29, 2021 03:16 Inactive
@emmatown emmatown enabled auto-merge (squash) June 29, 2021 03:16
@vercel vercel bot temporarily deployed to Preview June 29, 2021 03:19 Inactive
@emmatown emmatown merged commit 03f535b into master Jun 29, 2021
@emmatown emmatown deleted the id-field-experimenting branch June 29, 2021 03:24
Nikitoring pushed a commit to Nikitoring/keystone that referenced this pull request Sep 13, 2021
* Id field experimenting

* word

* Try a different default to see what our tests do

* Update things

* snapshots

* Update things

* Remove a thing

* field view

* Fix ts errors

* WIP

* Fix a thing

* Fix more tests

* Fix things

* Fix more things

* More fixes

* Reorder a thing so the failing output is easy to debug

* Try a thing

* Update schemas

* Tests

* Update docs

* Add uuid dep

* Changeset

* Words

* Add another changeset

* Some more tests and cuid change

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update .changeset/eight-lions-stare.md

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
Nikitoring pushed a commit to Nikitoring/keystone that referenced this pull request Sep 13, 2021
* Id field experimenting

* word

* Try a different default to see what our tests do

* Update things

* snapshots

* Update things

* Remove a thing

* field view

* Fix ts errors

* WIP

* Fix a thing

* Fix more tests

* Fix things

* Fix more things

* More fixes

* Reorder a thing so the failing output is easy to debug

* Try a thing

* Update schemas

* Tests

* Update docs

* Add uuid dep

* Changeset

* Words

* Add another changeset

* Some more tests and cuid change

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update .changeset/eight-lions-stare.md

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
Nikitoring pushed a commit to Nikitoring/keystone that referenced this pull request Sep 14, 2021
* Id field experimenting

* word

* Try a different default to see what our tests do

* Update things

* snapshots

* Update things

* Remove a thing

* field view

* Fix ts errors

* WIP

* Fix a thing

* Fix more tests

* Fix things

* Fix more things

* More fixes

* Reorder a thing so the failing output is easy to debug

* Try a thing

* Update schemas

* Tests

* Update docs

* Add uuid dep

* Changeset

* Words

* Add another changeset

* Some more tests and cuid change

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update .changeset/eight-lions-stare.md

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
Nikitoring pushed a commit to Nikitoring/keystone that referenced this pull request Sep 14, 2021
* Id field experimenting

* word

* Try a different default to see what our tests do

* Update things

* snapshots

* Update things

* Remove a thing

* field view

* Fix ts errors

* WIP

* Fix a thing

* Fix more tests

* Fix things

* Fix more things

* More fixes

* Reorder a thing so the failing output is easy to debug

* Try a thing

* Update schemas

* Tests

* Update docs

* Add uuid dep

* Changeset

* Words

* Add another changeset

* Some more tests and cuid change

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update docs/pages/docs/apis/config.mdx

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

* Update .changeset/eight-lions-stare.md

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>

Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants