Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@keystonejs/fields

keystonejs10.2kMIT22.1.3TypeScript support: definitely-typed

KeystoneJS Field Types including Text, Password, DateTime, Integer, and more.

readme

Fields

This is the last active development release of this package as Keystone 5 is now in a 6 to 12 month active maintenance phase. For more information please read our Keystone 5 and beyond post.

Keystone contains a set of primitive fields types that can be imported from the @keystonejs/fields package:

Field type Description
CalendarDay An abstract "day" value; useful for Birthdays and other all-day events always celebrated in the local time zone
Checkbox A single Boolean value
DateTime A point in time and a time zone offset
DateTimeUtc Represents points in time, stored in UTC
Decimal Exact, numeric values in base-10; useful for currency, etc.
File Files backed various storage mediums: local filesystem, cloud based hosting, etc.
Float An imprecise numeric value, stored as a floating point
Integer A whole number
Password A bcrypt hash of the value supplied; used by the Password auth strategy
Relationship A link between the current list and others, often paired with a field on the other list
Select One of several predefined string values, presented as a dropdown
Slug Generate unique slugs (aka. keys, url segments) based on the item's data
Text A basic but versatile text field of arbitrary length
Url Extends the Text type to store HTTP URLs
Uuid Universally Unique Identifiers (UUIDs); useful for id fields
Virtual Read-only field with a developer-defined resolver, executed on read

In addition to these, some complex types are packaged separately:

Field type Description
Content Block-based content for composing rich text such as blog posts, wikis, and even complete pages
AuthedRelationship Extendes the Relationship type; automatically set to the currently authenticated item during a create mutation
AutoIncrement An automatically incrementing integer; the default type for id fields when using the Knex DB adapter
Markdown Markdown content; based on the Text type and using the CodeMirror editor in the Admin UI
MongoId Arbitrary Mongo ObjectId values; the default type for id fields when using the Mongoose DB adapter
Wysiwyg Rich text content; based on the Text type and using the TinyMCE editor in the Admin UI
LocationGoogle Data from the Google Maps API
Color Hexidecimal RGBA color values; uses a color picker in the Admin UI
OEmbed Data in the oEmbed format; allowing an embedded representation of a URL on third party sites
CloudinaryImage Allows uploading images to the Cloudinary image hosting service
Unsplash Meta data from the Unsplash API and generates URLs to dynamically transformed images

Tip: Need something else? Keystone lets you create custom field types to support almost any use case.

Usage

Fields definitions are provided when creating a list. Field definitions should be an object where the key is the field name and the value is an object containing the fields config:

const { Text } = require('@keystonejs/fields');

keystone.createList('Post', {
  fields: {
    title: { type: Text },
  },
});

Config

Fields share some standard configuration options.

Option Type Default Description
type FieldType (required)
adminDoc String false A description for the field used in the AdminUI.
schemaDoc String false A description for the field used in the GraphQL schema.
defaultValue Any | Function undefined A valid default value for the field type. Functions must return a valid value. Use undefined to set no default, and null to set an empty default.
isUnique Boolean false Whether or not the field should be unique.
isRequired Boolean false Whether or not the field should be mandatory.
access Boolean | Function | Object true See: Access control options for fields.
label String | Label for the field.
adminConfig Object {} Additional config which can be used when customizing admin-ui

Note: Many field types have additional config options. See the documentation for individual field types for more detail.

type

A valid Keystone field type.

label

Sets the label for the field in the AdminUI

adminDoc

A description of the field used in the AdminUI.

schemaDoc

A description of the field used used in the GraphQL schema.

adminConfig

Additional field configs affecting field rendering or display in admin-ui.

adminConfig.isReadOnly

Fields with isReadOnly set to true will be disabled preventing users from modifying them in the Admin UI. This does not affect access control and fields can still be updated via GraphQL.

keystone.createList('Post', {
  fields: {
    title: { type: Text },
    slug: {
      type: Slug,
      adminConfig: {
        isReadOnly: true, //slug can be created automatically and you may want to show this as read only
      },
    },
  },
});

defaultValue

Sets the value when no data is provided.

keystone.createList('Post', {
  fields: {
    title: {
      type: Text,
      defaultValue: ({ context, originalInput }) => {
        /**/
      },
    },
    description: { type: Text, defaultValue: 'Lorem ipsum...' },
  },
});

For a 'nullable' field, set defaultValue: null.

The defaultValue can be a String or Function. Functions should returns the value, or a Promise for the value.

isUnique

Specifies whether the value should be unique or not. Will return an error is a user tries to create a field with a non-unique value.

isRequired

Specifies whether the field is required or not. Will return an error if mutations do not contain data.

access

Access control options for fields.

Options for create, read, update and delete - can be a function or Boolean. See the access control API documentation for more details.

Note: Field level access control does not accept graphQL where clauses.

cacheHint

HTTP cache hint for field.

Only static hints are supported for fields.

changelog

@keystonejs/fields

22.1.3

Patch Changes

22.1.2

Patch Changes

22.1.1

Patch Changes

22.1.0

Minor Changes

Patch Changes

22.0.1

Patch Changes

22.0.0

Major Changes

  • b97216a65 #4622 Thanks @renovate! - Updated react and react-dom to v17

  • 8d0be8a89 #4815 Thanks @timleslie! - Added a .sudo() method to context objects, which is equivalent to the common operation context.createContext({ skipAccessControl: true }).

Minor Changes

  • 4035218df #4512 Thanks @renovate! - Upgraded dependency apollo-server-express to ^2.21.0. Apollo Server can now be installed with graphql@15 without causing peer dependency errors or warnings.

Patch Changes

21.1.0

Minor Changes

  • a886039a1 #4707 Thanks @timleslie! - Added support for the Decimal field type with the Prisma database adapter.

  • 680169cad #4706 Thanks @timleslie! - Changed id sub-field generator for File field type from mongoose ObjectID to cuid when using Knex or Prisma adapter.

Patch Changes

21.0.2

Patch Changes

21.0.1

Patch Changes

21.0.0

Major Changes

  • 841be0bc9 #4544 Thanks @mitchellhamilton! - Replaced useCompiledBcrypt option with bcrypt option which accepts an alternative implementation of bcrypt(such as the native bcrypt npm package) in the password field type.

    For example, if you had the following field definition:

    password: { type: Password, useCompiledBcrypt: true }

    you will need to change it to:

    password: { type: Password, bcrypt: require('bcrypt') }

Minor Changes

Patch Changes

20.1.3

Patch Changes

20.1.2

Patch Changes

20.1.1

Patch Changes

20.1.0

Minor Changes

  • fab97f6b4 #4238 Thanks @timleslie! - Added a .getBackingTypes() method to all Field implementations, which returns { path: { optional, type } }. This method will be used to generate typescript types in our upcoming new interfaces.

Patch Changes

20.0.0

Major Changes

Patch Changes

19.1.1

Patch Changes

19.1.0

Minor Changes

  • f13d7eaab #3928 Thanks @gautamsi! - Added format option to DateTimeUtc field similar to DateTime field. This affects only the admn-ui display

Patch Changes

19.0.0

Major Changes

Patch Changes

18.0.0

Major Changes

Patch Changes

17.1.3

Patch Changes

17.1.2

Patch Changes

17.1.1

Patch Changes

17.1.0

Minor Changes

  • 69d627813 #3501 Thanks @singhArmani! - Removed unsupported filters for File, CloudinaryImage, LocationGoogle, Unsplash, and OEmbed field types.

Patch Changes

17.0.0

Major Changes

  • d38c9174f #3394 Thanks @timleslie! - Converted Field getters .gqlUpdateInputFields and .gqlCreateInputFields into methods, .gqlUpdateInputFields({ schemaName }) and ...gqlCreateInputFields({ schemaName }).

Patch Changes

16.1.0

Minor Changes

Patch Changes

16.0.0

Major Changes

  • d38a41f25 #3308 Thanks @MadeByMike! - Move @keystonejs/fields-datetime-utc into @keystonejs/fields. Please update your imports from @keystonejs/fields-datetime-utc to @keystonejs/fields.

  • 5ede731fc #3305 Thanks @MadeByMike! - Moved the Location field from @keystonejs/fields to @keystonejs/fields-location-google and renamed to LocationGoogle. If you were using the Location field from @keystonejs/fields, please install @keystonejs/fields-location-google and import LocationGoogle from it.

  • 1d9068770 #3280 Thanks @MadeByMike! - Moved @keystonejs/fields-cloudinary-image, @keystonejs/fields-unsplash and @keystonejs/fields-oembed out of the core fields package @keystonejs/fields.

    const { CloudinaryImage, Unsplash, OEmbed } = require('@keystonejs/fields');

    Needs to be changed to:

    const { CloudinaryImage } = require('@keystonejs/fields-cloudinary-image');
    const { Unsplash } = require('@keystonejs/fields-unsplash');
    const { OEmbed } = require('@keystonejs/fields-oembed');
  • e44102e9f #3307 Thanks @MadeByMike! - Moved the Color field from @keystonejs/fields to @keystonejs/fields-color.

    Note: If using the Color field you need to update imports to point to @keystonejs/fields-color.

Minor Changes

Patch Changes

15.0.0

Major Changes

  • af5171563 #3283 Thanks @timleslie! - Removed BaseListAdapter.findFieldAdapterForQuerySegment() and MongoRelationshipInterface.supportsRelationshipQuery().

  • 7da9d67d7 #3284 Thanks @timleslie! - Removed MongoRelationshipInterface.getRefListAdapter() and KnexRelationshipInterface.getRefListAdapter().

  • c3883e01c #3261 Thanks @timleslie! - many relationships now have a GraphQL type of [Item!]!, rather than [Item].

    The old type of [Item] implied that the relationship field could return null, or that some of the items it returned could be null. In practice, neither of these things ever happened. The new type better reflects this reality.

    The filter argument {path}_is_null has also been removed for many relationships, as it does not apply to a non-null array type.

Patch Changes

14.0.0

Major Changes

  • 5fc97cbf4 #3171 Thanks @timleslie! - Hooks no longer recieve a { query } argument. This functionality has been superseded by context.executeGraphQL().

    {
      ...
      hooks: {
        resolveInput: async ({ actions: { query } } ) => {
          ...
          const { data, errors } = await query(`{ ... }`);
          ...
        }
      }
    }

    should be changed to

    {
      ...
      hooks: {
        resolveInput: async ({ context } ) => {
          ...
          const { data, errors } = await context.executeGraphQL({ query: `{ ... }` });
          ...
        }
      }
    }

    See the docs for more details on how to use context.executeGraphQL().

Patch Changes

13.0.2

Patch Changes

13.0.1

Patch Changes

13.0.0

Major Changes

  • b693b2fa8 #3002 Thanks @timleslie! - The CalendarDay field type options yearRangeFrom and yearRangeTo have been removed, and replaced with dateFrom and dateTo. These options take an ISO8601 formatted date string in the form YYYY-MM-DD, e.g. 2020-06-30. These values are now validated on the server-side, rather than just on the client-side within the Admin UI.

    If you are currently using yearRangeFrom or yearRangeTo you will need to make the following change:

    birthday: { type: CalendarDay, yearRangeFrom: 1900, yearRangeTo: 2100 }

    becomes

    birthday: { type: CalendarDay, dateFrom: '1900-01-01', dateTo: '2100-12-31' }

Patch Changes

12.0.1

Patch Changes

12.0.0

Major Changes

  • ea9608342 #2976 Thanks @Vultraz! - Refactored how list and item queries and generated. Field controllers' getFilterGraphQL method now returns an object in the format { filter: value } rather than a GraphQL string. Additionally, getFilterValue should now return undefined instead of null if the filter should not be submitted.

Minor Changes

  • c2ebb51c7 #2258 Thanks @gautamsi! - * Added isReadOnly option on field's adminConfig. Fields with this option set will be excluded from the create form, and set as disabled in the update form in the Admin UI.

    • Updated the item detail page to include fields with access { update: false } in a disabled state, rather than excluded the form.
    • Updated all Field Views to accept isDisabled prop. When set to true this will disable the field input.

    Example:

    keystone.createList('Todo', {
      fields: {
        name: { type: Text, isRequired: true },
        someReadOnlyField: {
          type: Text,
          adminConfig: {
            isReadOnly: true,
          },
          defaultValue: 'Some default value',
        },
      },
    });
  • fdfb01417 #2947 Thanks @timleslie! - Added support for arguments being defined on Virtual fields.

Patch Changes

11.0.0

Major Changes

  • e9a0de2c #2927 Thanks @Vultraz! - Upgraded to date-fns 2.x. This version uses Unicode tokens for its formatting strings. A conversion table is available here.

    This change only affects the CalendarDay and DateTime fields' format config option.

    The following script utilizes the @date-fns/upgrade package and can be used to convert old formatting strings:

    const { convertTokens } = require('@date-fns/upgrade/v2');
    
    console.table(
      [
        // Add date-dns 1.x formatting strings here.
      ].map(str => ({
        v1: str,
        v2: convertTokens(str).replace(/'/g, ''),
      }))
    );

    Do note this converts symbols to standalone style as opposed to formatted style which may not always be desired. For example, DD/MM/YYYY would be converted to dd/LL/yyyy instead of dd/MM/yyyy. See here for more information on which you should use.

Patch Changes

10.0.0

Major Changes

  • d8584765 #2906 Thanks @timleslie! - Removed Controller.adminMeta in favour of explicit values for .readViews, .preloadViews, .getListByKey, .adminPath, and .authStrategy.

Minor Changes

  • 72e0a4e1 #2895 Thanks @Vultraz! - The base FieldController class no longer takes the owning list as a second argument.

  • 6e507838 #2890 Thanks @Vultraz! - Refactored the Unsplash content block to use Apollo query hooks.

  • e2800875 #2897 Thanks @Vultraz! - Elevated isOrderable, isRequired, and adminDoc keys to direct FieldController properties.

  • bcf03a7f #2873 Thanks @Vultraz! - Cleaned up CreateItemModal implementation. The component is no longer passed to field views and should be imported from the @keystonejs/app-admin-ui package instead.

Patch Changes

9.0.5

Patch Changes

9.0.4

Patch Changes

9.0.3

Patch Changes

9.0.2

Patch Changes

9.0.1

Patch Changes

9.0.0

Major Changes

  • fd685241 #2000 Thanks @timleslie! - ## Release - Arcade

    This release introduces a new and improved data schema for Keystone. The new data schema simplifies the way your data is stored and will unlock the development of new functionality within Keystone.

    Important: You will need to make changes to your database to take advantage of the new data schema. Please read the full release notes for instructions on updating your database.

Patch Changes

8.0.0

Major Changes

  • 2ae2bd47 #2623 Thanks @maryam-mv! - Updated @sindresorhus/slugify to fix a problem where it was producing unexpected output, eg. adding unexpected underscores: 'NAME1 Website' => 'nam_e1_website'. The slugify output for db name may be different with this change. For the above example, the output will now be 'name_1_website' for the same string.

    If your database name changes unexpectedly, you can add an environment variable called DATABASE_URL with a full path to the database. For more information on configuring database connections read the documentation for the Knex adapter or Mongoose adapter.

    If you are using the Slug field type, in some edge-cases, slugs may change when saved after this update. You can use the generate option on the slug field for custom slug generation if required.

Minor Changes

  • d138736d #2617 Thanks @JedWatson! - Added dataType support to Select fields, values can now be stored as enums, strings or integers

Patch Changes

7.0.2

Patch Changes

7.0.1

Patch Changes

7.0.0

Major Changes

  • 161bf3e5 #2523 Thanks @timleslie! - Replaced default bcrypt implementation from bcrypt to bcryptjs. You can use the new useCompiledBcrypt config option to the Password field to keep the use of the bcrypt package. bcrypt must be manually listed in your package.json if use set { useCompiledBcrypt: true }, as it is no longer a dependency of Keystone.

Patch Changes

6.3.2

Patch Changes

6.3.1

Patch Changes

6.3.0

Minor Changes

Patch Changes

6.2.3

Patch Changes

6.2.2

Patch Changes

6.2.1

Patch Changes

6.2.0

Minor Changes

  • 6bc87d43 #2279 - Added React hooks to the AdminUI.

    This PR changes the way the <CreateItem/> component works internally. It also paves the way for future AdminUI extensions by exporting front-end components and utilities from @keystonejs/app-admin-ui/components. Initially this includes a <ListProvider/> component that is currently being consumed by the relationship field.

  • 6eb23086 #2287 - Added adminDoc configuration option to all field types.

Patch Changes

6.1.0

Minor Changes

  • 220d3a4b #2005 - The presentation and usability of the content blocks editor was improved.

Patch Changes

6.0.5

Patch Changes

6.0.4

Patch Changes

  • 85f21ced #2122 - Fix for cloudinary images block error when serialized

6.0.3

Patch Changes

6.0.2

Patch Changes

6.0.1

Patch Changes

  • 33d22c7 #2078 - Convert to use Apollo hooks

  • 33d22c7 #2078 - Fixed a bug in the Knex field adapter for virtual fields.

  • 33d22c7 #2078 - Fixed several issues with the CalendarDay field:

    • Ensured format, yearRangeFrom, and yearRangeTo defaults are set correctly
    • Removed non-functional yearPickerType
    • Made displayed date format consistent between list and detailed views
    • Moved date range validation to validateInput- Updated dependencies [33d22c7]:
    • @arch-ui/alert@0.0.10
    • @arch-ui/day-picker@0.0.16

6.0.0

Major Changes

Minor Changes

  • 267dab2f #1799 Thanks @SeanDoyleGit! - Resolved unsplash images duplication issue in react-slate.

  • af1e9e4d #1963 Thanks @gemscng! - Text field filter is now case insensitive by default.

  • 0145f7e2 #1959 Thanks @LiamAttClarke! - Added in and not_in filters to IntegerField.

  • 2cc83b12 #1988 Thanks @MadeByMike! - Added an isOrderable option to field implementation that controls whether the field is sortable in the AdminUI. Defaults to false and is set to true by sortable field types.

    The parseFieldAccess method can now also be overwritten in the field implementation class.

  • 6a348b93 #1978 Thanks @MadeByMike! - Added a new field type Virtual. This allows creation of fields that return data computed from other field values or outside Keystone.

Patch Changes

5.2.0

Minor Changes

  • 1a723a54 #1880 Thanks @gautamsi! - Replaced RelationShip field's implementation of CreateItemModel with a prop provided by admin-ui

    Exported following components from admin-ui which can be used outside of admin-ui to have same look and feel when working with Lists. One simple use is in custom pages where this can be customized differently than core list pages

    • List
    • ListData
    • ListLayout
    • ListManage
    • FieldSelect
    • Search
    • ActiveFilters
    • Pagination
    • CreateItemModal
    • DeleteItemModal
    • DeleteManyItemsModal
    • ListTable
    • PageLoading
    • ToastContainer
    • UpdateManyItemsModal
    • Popout

Patch Changes

5.1.0

Minor Changes

Patch Changes

5.0.2

Patch Changes

5.0.1

Patch Changes

5.0.0

Major Changes

  • 7b4ed362 #1821 Thanks @jesstelford! - Release @keystonejs/* packages (つ^ ◡ ^)つ

    • This is the first release of @keystonejs/* packages (previously @keystone-alpha/*).
    • All packages in the @keystone-alpha namespace are now available in the @keystonejs namespace, starting at version 5.0.0.
    • To upgrade your project you must update any @keystone-alpha/* dependencies in package.json to point to "@keystonejs/*": "^5.0.0" and update any require/import statements in your code.

Patch Changes

@keystone-alpha/fields

15.0.0

Major Changes

Patch Changes

14.0.0

Major Changes

  • 6d7d0df0 #1729 Thanks @timleslie! - This change significantly changes how and when we populate many-relationships during queries and mutations. The behaviour of the GraphQL API has not changed, but queries should be more performant, particularly for items with many related items. The existingItem parameter in hooks will no longer have the many-relationship fields populated. List.listQuery() no longer populates many relationship fields. For most users there should not need to be any changes to code unless they are explicitly relying on a many-relationship field in a hook, in which case they will need to execute an explicit query to obtain the desired values.

Patch Changes

13.1.0

Minor Changes

Patch Changes

13.0.0

Major Changes

12.3.0

Minor Changes

  • 552e6fb6: Add support for schema cache hints

Patch Changes

  • 9b532072: Rename Keystone to KeystoneJS in docs where possible in docs

12.2.1

Patch Changes

  • 04aa6a08: Fix regression when parent list of a Content field had a where clause as its access control.

12.2.0

Minor Changes

  • ee000a7f: Added alpha channel support to the Color field. NOTE: This introduces a backwards-compatible change in the format saved to the database. The old format was a 6-character hex string preceded by a #, eg; #663399. The new format is an rgba string, eg; rgba(102, 51, 153, 1). Both formats are fully supported in CSS, and the Color field will correctly handle old values stored in the hex format.

12.1.0

Minor Changes

  • f56ffdfd: Apply access control to auxiliary lists

12.0.0

Major Changes

  • 9ade2b2d: Add support for access: { auth: ... } which controls whether authentication queries and mutations are accessible on a List

    If you have a List which is being used as the target of an Authentication Strategy, you should set access: { auth: true } on that list.

Minor Changes

  • e5ad5ef1: Only generate relationship update types when needed

Patch Changes

11.0.0

Major Changes

  • 89c0d7e9: The .access property of Fields is now keyed by schemaName. As such, a number of getters have been replaced with methods which take { schemaName }.

    • get gqlOutputFields() -> gqlOutputFields({ schemaName })
    • get gqlOutputFieldResolvers() -> gqlOutputFieldResolvers({ schemaName })
    • get gqlAuxFieldResolvers() -> gqlAuxFieldResolvers({ schemaName })
    • get gqlAuxQueryResolvers() -> gqlAuxQueryResolvers({ schemaName })
    • get gqlAuxMutationResolvers() -> gqlAuxMutationResolvers({ schemaName })
    • get gqlQueryInputFields() -> gqlQueryInputFields({ schemaName })
  • a8e9378d: Keystone, List and Field constructors now take schemaNames as config options. A number of methods also now take schemaName parameters.

    • keystone.getTypeDefs() -> keystone.getTypeDefs({ schemaName })
    • keystone.getAdminSchema() -> keystone.getAdminSchema({ schemaName })
    • keystone.dumpSchema(file) -> keystone.dumpSchema(file, schemaName)
    • keystone.getAdminMeta() -> keystone.getAdminMeta({ schemaName })
    • list.getAdminMeta() -> list.getAdminMeta({ schemaName })
    • field.getAdminMeta() -> field.getAdminMeta({ schemaName })

Patch Changes

  • bc0b9813: parseListAccess and parseFieldAccess now take schemaNames as an argument, and return a nested access object, with the schemaNames as keys.

    For example,

    parseListAccess({ defaultAccess: false, access: { public: true }, schemaNames: ['public', 'private'] }

    will return

    {
      public: { create: true, read: true, update: true, delete: true },
      private: { create: false, read: false, update: false, delete: false },
    }

    These changes are backwards compatible with regard to the access argument, so

    const access = { create: true, read: true, update: true, delete: true };
    parseListAccess({ access, schemaNames: ['public', 'private'] }

    will return

    {
      public: { create: true, read: true, update: true, delete: true },
      private: { create: true, read: true, update: true, delete: true },
    }

10.7.2

Patch Changes

  • 99dc6cae: Revert usage of Apollo Hooks

10.7.1

Patch Changes

  • d9bd327e: Embed fields should handle receiving null or '' when being unset

10.7.0

Minor Changes

  • 79e362c0: upgrade react-apollo and use hooks instead of Query and Mutation components

10.6.2

Patch Changes

  • 4ab3cc38: OEmbed & Unsplash types no longer lose their value on update.

10.6.1

Patch Changes

  • 9c1b1886: CloudinaryImage & File fields no longer lose their value during update mutations

10.6.0

Minor Changes

  • f7ba8a35: Prefill nested creates for Relationship fields with back referennces

10.5.0

Minor Changes

  • 33ed590e: Respect static field-level access control in the Admin UI

10.4.0

Minor Changes

  • da65e1a0: Allow display and filtering of 'Id' column in Admin UI

10.3.0

Minor Changes

  • a640471a: - Add Slug.alwaysMakeUnique option to force calling makeUnique even when initially generated slug may already be unique to prevent accidental data leak.
    • Fix a bug where items restricted via access control weren't considered when testing a Slug for uniqueness.

10.2.0

Minor Changes

  • e049cfcb: Support defaultValue as a function at mutation execution time
  • e049cfcb: Support defaultValue as a function in view Controllers

Patch Changes

10.1.0

Minor Changes

  • d7819a55: Add a Slug field type for auto-generating slugs based on other fields.

Patch Changes

  • 653aa0e2: Remove incorrect Cell view config from Slug field
  • 9c3b7436: Ensure searchUnsplash mutation returns results with a non-null id

10.0.0

Major Changes

  • 42c3fbc9: Switching lists to use standard field types for primary keys (instead of weird pseudo-field)

Minor Changes

  • 42c3fbc9: Adding precision and scale as knexOptions for the Decimal field type
  • 42c3fbc9: Adding isIndexed field config and support for in most field types
  • 42c3fbc9: Check for the number type in label resolver to prevent false positive on zero.

Patch Changes

  • 42c3fbc9: Upgrade emotion to 10.0.14
  • 42c3fbc9: Upgrade prettier to 1.18.2
  • 42c3fbc9: Fixing issue with the Select fields on Knex; options not being applied correctly
  • 42c3fbc9: Upgrade to mongoose 5.6.5
  • 42c3fbc9: Fixing application of some field config on knex
  • 42c3fbc9: Upgrade graphql to 14.4.2
  • 42c3fbc9: Ensure the CloudinaryImage Content Block correctly updates the nested Slate.js image Node data instead of overwiting it which could cause issues for the image renderer expecting an Immutable Map, but receiving a plain Object.

9.1.0

Minor Changes

  • 18064167:

    Adding knexOptions to the KnexFieldAdapter to support DB-level config for nullability (isNotNullable) and defaults (defaultTo)

Patch Changes

  • 4007f5dd:

    Adding field instance to the BaseFieldAdapter constructor arguments

9.0.0

Major Changes

  • 2b094b7f:

    Refactoring the knex adapter (and field adapters) to give the field type more control of the table schema (add 0 or multiple columns, etc)

8.1.0

Minor Changes

  • e945926c:

    Adding Uuid field type with Mongoose and Knex adapters

Patch Changes

  • ac7934fe:

    CloudinaryImage, Unsplash, and OEmbed blocks will correctly re-connect to existing block data if present rather than disconnecting and reconnecting on every save of the Content editor.

  • Updated dependencies ac7934fe:

8.0.0

Major Changes

  • b6a9f6b9:

    Extract Content field into its own package: @keystone-alpha/field-content.

Patch Changes

  • 98bef287:

    Fix the Relationship field type not allowing relationships to be removed from the Admin UI

7.2.0

Minor Changes

  • c5c46545:

    Add searchUnsplash GraphQL query when using the Unsplash field type

Patch Changes

  • 148400dc:

    Using connect: [] and create: [] in many-relationship queries now behaves as expected.

  • 384135b1:

    Minor bump of bcrypt version

7.1.0

Minor Changes

  • 91fffa1e:

    Add oEmbed Content Block with adapter-specific renderers.

  • 91fffa1e:

    Add an Unsplash Image type which fetches data from the Unsplash API

  • 8799190e:

    Expose options.adminMeta to Content Blocks.

  • 91fffa1e:

    Add an Unsplash Image Block for the Content field which takes an Unsplash Image ID and displays the image within the Content field.

Patch Changes

7.0.1

Patch Changes

  • c3daef1a:

    Correctly guard against undefined serverErrors in RelationshipSelect

7.0.0

Major Changes

  • 30c1b1e1:

    • Expose a new method on field Controllers: field#validateInput().
      • /**
         * Perform client-side data validations before performing a
         * mutation. Any errors or warnings raised will abort the mutation and
         * re-render the `Field` view with a new `error` prop.
         *
         * This method is only called on fields whos `.hasChanged()` property returns
         * truthy.
         *
         * If only warnings are raised, the Admin UI will allow the user to confirm
         * they wish to continue anyway. If they continue, and no values have changed
         * since the last validation, validateInput will be called again, however any
         * warnings raised will be ignored and the mutation will proceed as normal.
         * This method is called after `serialize`.
         *
         * @param {Object} options
         * @param {Object} options.resolvedData The data object that would be sent to
         * the server. This data has previously been fed through .serialize()
         * @param {Object} options.originalInput The data as set by the `Field`
         * component. This data has _not_ been previously fed through .serialize().
         * @param {addFieldWarningOrError} options.addFieldValidationError
         * @param {addFieldWarningOrError} options.addFieldValidationWarning
         * @return undefined
         */
        validateInput = ({
          resolvedData,
          originalInput,
          addFieldValidationError,
          addFieldValidationWarning,
        }) => {
          // Call addFieldValidationError / addFieldValidationWarning here
        };
    • Password field is now using validateInput() which enforces isRequired and minLength checks in the Admin UI.

Minor Changes

  • 5c28c142:

    • Add OEmbed field

      const { Keystone } = require('@keystone-alpha/keystone');
      const { OEmbed } = require('@keystone-alpha/fields');
      const { IframelyOEmbedAdapter } = require('@keystone-alpha/oembed-adapters');
      
      const keystone = new Keystone(/* ... */);
      
      const iframelyAdapter = new IframelyOEmbedAdapter({
        apiKey: '...', // Get one from https://iframely.com
      });
      
      keystone.createList('User', {
        fields: {
          portfolio: {
            type: OEmbed,
            adapter: iframelyAdapter,
          },
        },
      });

Patch Changes

  • 1b4cf4e0:

    • Correctly read auth strategy info for displaying the "setCurrentUser" toggle on Relationship fields in the Admin UI
  • 3958a9c7:

    Fields configured with isRequired now behave as expected on create and update, returning a validation error if they are null.

  • 19fe6c1b:

    Move frontmatter in docs into comments

  • Updated dependencies 16befb6a:

6.2.2

Patch Changes

  • 25f9ad7e:

    Compile Controller base class to ES5 so that non-native classes can extend it

6.2.1

Patch Changes

  • 07692ee7:

    Fix item details updating failures when Access Control enabled on a field, but that field is not edited (ie; we were sending unedited data to the mutation which would (correctly) fail).

6.2.0

Minor Changes

  • c5a1d301:

    • CloudinaryImage single image block correctly loads and displays saved image
    • AdminUI deserialises fields JIT before rendering

6.1.1

Patch Changes

6.1.0

Minor Changes

  • 29728d5e:

    Allow blocks to pick data sent to the adminUI via extendAdminMeta()

Patch Changes

  • e502af66:

    Fix dist directories not being cleared before builds causing broken builds with build-field-types

6.0.0

Major Changes

  • 9dbed649:

    Explicit field config options are no longer available on field.config for field Implementaiton objects.

  • 119448fc:

    • Field view Controllers: Rename .getValue() to .serialize() and add .deserialize() to enable handling pre-save to server & post-read from server respectively.
  • 1a7b706c:

    • Use build-field-types
  • bd0ea21f:

    • { mongooseOptions: { isRequired: true } } should be replaced by { isRequired: true }
  • 119448fc:

    • Field view Controllers: Rename .getIntialData() to .getDefaultValue() to better reflect the purpose of the function.

Minor Changes

  • 81b481d0:

    • Added support for isMultiline to Text field type
  • c9102446:

    • Add a mechanism for loading multiple Suspense-aware components in parallel

Patch Changes

5.0.0

  • [patch]5c36ea0b:

    • Content Field no longer throws when no blocks specified or server data is corrupt
  • [patch]ec76b500:

    • Initialise Block Constructors inside Field Controller
  • [major]ec76b500:

    • Rename Content Editor field to document for slate.js consistency
  • [major]85b74a2c:

    • Expose result of running relationship operations (create/connect/disconnect)
  • [patch]e75c105c:

    • admin revamp
  • [patch]d145fcb9:

    • Correctly return null to the Admin UI for to-single relationship fields which don't have any ID set
  • [patch]ec76b500:

    • Ensure Content Block views are always loaded even when not imported

4.0.0

3.0.2

  • [patch]03ea2b1d:

    • Bump version of @arch-ui/layout

3.0.1

3.0.0

  • [patch]39067f44:

    • Add text date and time pickers
  • [major]9a9f214a:

    • Build field type views before publishing to npm and stop running Babel on Keystone packages in node_modules in the Admin UI

2.0.0

1.0.1

  • [patch]1f0bc236:

    • Update the package.json author field to "The Keystone Development Team"
  • [patch]9534f98f:

    • Add README.md to package
  • [patch]c0e64c01:

    • Move system tests into api-tests package

1.0.0

  • [major] 8b6734ae:

    • This is the first release of keystone-alpha (previously voussoir). All packages in the @voussoir namespace are now available in the @keystone-alpha namespace, starting at version 1.0.0. To upgrade your project you must update any @voussoir/<foo> dependencies in package.json to point to @keystone-alpha/<foo>: "^1.0.0" and update any require/import statements in your code.

@voussoir/fields

3.1.0

3.0.0

  • [patch] 513c7b63:

    • Rename MongoSelectInterface to MongoRelationshipInterface in the relationship field type
  • [minor] 5f891cff:

    • Add a setupHooks method to BaseFieldAdapter
  • [patch] 723371a0:

    • Correctly surface nested errors from GraphQL
  • [major] 53e27d75:

    • Removes methods from Mongoose adapter classes: getFieldAdapterByQueryConditionKey, getSimpleQueryConditions, getRelationshipQueryConditions, getQueryConditions, getRelationshipQueryConditions, getRefListAdapter, hasQueryCondition.
  • [minor] 4faf5cfd:

    • Add withMeta flag to Relationship field for disabling meta queries
  • [patch] 306f0b7e:

    • Remove recalcHeight prop from Filter props
  • [patch] 266b5733:

    • Don't try to resolve nested mutations which will be later backfilled
  • [minor] dc53492c:

    • Add support for the Knex adapter
  • [patch] 7ce811ab:

    • Converts mongoose ObjectIds to string in File field types
  • [major] 5f8043b5:

    • Simplify Field component api
      • Replace item prop with value prop which is equal to item[field.path]
      • Replace itemErrors prop with error prop which is equal to itemErrors[field.path]
      • Change onChange prop so that it only accepts the value rather than the field and the value
      • Remove initialData prop which wasn't used in a Field component and was only pass to the Field components in one the places where the Field component is used
  • [minor] f37a8086:

    • Can now dump the GraphQL schema with keystone.dumpSchema(filePath)
  • [patch] 9f2ee393:

    • Add adapter parameter to setupServer() and add multiAdapterRunners()
  • [patch] 860c3b80:

    • Add a postConnect method to list adapters to capture all the work which needs to be done after the database has been connected to
  • Updated dependencies [aca26f71]:

  • Updated dependencies [6471fc4a]:
  • Updated dependencies [6471fc4a]:
  • Updated dependencies [48773907]:
  • Updated dependencies [a3d5454d]:

2.0.1

  • [patch] 3aede2f5:

    • Make relationship select work for large lists
  • [patch] c3dd4295:

    • Don't clobber DateTime fields during update mutation
  • [patch] 8d8666ad:

    • Dependency upgrade: graphql -> 14.0.3, graphql-tools -> 4.0.3

2.0.0

  • [patch] 21626b66:

    • preSave/postRead item hooks run consistently
  • [patch] 8145619f:

    • update to selecting and managing items in the list view
  • [minor] cd885800:

    • Update the field hooks API to use the officially sanctioned hook names.
  • [major] c83c9ed5:

    • Add Keystone.getAccessContext and remove List.getAccessControl, List.getFieldAccessControl, and Field.validateAccessControl.
  • [patch] c3ebd9e6:

    • Update resolver code to make all list access checks explicit
  • [patch] 8ab899dd:

    • Internal refactor of nested mutation handling for relationships
  • [patch] 929b177c:

    • Enable sorting on DateTime fields
  • [minor] 33843c9e:

    • Update the backlink queue API
  • [major] 01718870:

    • Field configuration now tasks isRequired and isUnique, rather than required and unique
  • [minor] 3801e040:

    • Separate out the pre-hooks for resolving relationship fields from the field.resolveInput hooks
  • [patch] 023a5c72:

    • Enable setting DateTime to null
  • [patch] d22820b1:

    • Rename keystone.session to keystone.sessionManager
      • Rename keystone.session.validate to keystone.sessionManager.populateAuthedItemMiddleware
      • Rename keystone.session.create to keystone.sessionManager.startAuthedSession
      • Rename keystone.session.destroy to keystone.sessionManager.endAuthedSession
  • [patch] 8fc0abb3:

    • Make DayPicker scrollable
  • [patch] fc1a9055:

    • Update dependencies to latest patch versions
  • Updated dependencies [ffc98ac4]:

1.4.0

  • [minor] 3ae588b7:

    • Rename testAccessControl functions to validateAccessControl
  • [patch] ff4b98c5:

    • Consolidate mongoose schema pre/post hooks for field types
  • [patch] 45d4c379:

    • Update the functional API for Keystone List objects for consistency
  • [minor] 589dbc02:

    • navigation improvements and paper cut fixes
  • [minor] b0d19c24:

    • Use consistent query condition builders across all field types
  • Updated dependencies [9c383fe8]:

1.3.0

  • [minor] d94b517:

    Add _ksListsMeta query to gather type and relationship information

  • [minor] a3b995c:

    Add _ksListsMeta query to gather type and relationship information

  • [patch] ca7ce46:

    Correctly hide fields from Relationships when not readable

  • Updated dependencies [1d30a329" ]:

1.2.0

  • [minor] d94b517:

    Add _ksListsMeta query to gather type and relationship information

  • [minor] a3b995c:

    Add _ksListsMeta query to gather type and relationship information

  • [patch] ca7ce46:

    Correctly hide fields from Relationships when not readable

  • [minor] 47c7dcf6" :

    • Bump all packages with a minor version to set a new baseline

1.1.0

  • [minor] d94b517:

    Add _ksListsMeta query to gather type and relationship information

  • [minor] a3b995c:

    Add _ksListsMeta query to gather type and relationship information

  • [patch] ca7ce46:

    Correctly hide fields from Relationships when not readable

1.0.1

1.0.0

  • [patch] Bump all packages for Babel config fixes d51c833
  • [major] Text fields now default to case sensitive filtering. Insensitive filters available via the _i suffix (eg. name: "Jane" -vs- name_i: "jane"). This replaces the ${path}_case_sensitive boolean that could previously be specified when using Text field filters. This is all covered in more detail in #359. 445b699
  • [minor] Support unique field constraint for mongoose adapter 750a83e
  • [patch] Updated dependencies 9c75136

0.2.0

  • [minor] Add missing dependencies for which the mono-repo was hiding that they were missing fed0cdc

0.1.2

  • [patch] Rename readme files a8b995e

0.1.1

  • [patch] Remove tests and markdown from npm dc3ee7d