Skip to content

Commit

Permalink
Merge branch 'master' into checkbox-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Sep 10, 2021
2 parents 548373c + 8388452 commit 5144bdf
Show file tree
Hide file tree
Showing 87 changed files with 632 additions and 423 deletions.
5 changes: 0 additions & 5 deletions .changeset/curly-drinks-rush.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/dirty-apricots-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Updated system setup to only check for a valid `config.db.provider` once during `initConfig`.
6 changes: 6 additions & 0 deletions .changeset/early-snakes-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@keystone-ui/notice": minor
"@keystone-next/keystone": patch
---

Add Margin to error messages in the Admin UI Item Form
5 changes: 5 additions & 0 deletions .changeset/forty-jobs-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/cloudinary': major
---

Removed `isRequired` and `defaultValue` from the `cloudinaryImage` field. If you were using these options, the same behaviour can be re-created with the `validateInput` and `resolveInput` hooks respectively.
5 changes: 5 additions & 0 deletions .changeset/gold-pillows-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

Removed the deprecated `config.db.adapter` option. Please use `config.db.provider` to indicate the database provider for your system.
5 changes: 5 additions & 0 deletions .changeset/large-actors-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Fixed Relationship field inline connect throwing 400 errors when selecting a value.
5 changes: 5 additions & 0 deletions .changeset/nine-coins-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

Removed `context.schemaName` from the `context` object. This value was an internal API which is no longer required.
5 changes: 0 additions & 5 deletions .changeset/orange-rice-return.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/popular-goats-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Fixed a bug in `context.db.lists` API when finding items that don't exist.
5 changes: 5 additions & 0 deletions .changeset/real-jars-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

Removed `isRequired` and `defaultValue` from the `image` and `file` fields. If you were using these options, the same behaviour can be re-created with the `validateInput` and `resolveInput` hooks respectively.
5 changes: 5 additions & 0 deletions .changeset/rich-terms-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

Removed `defaultValue` and the undocumented `withMeta` option from the `relationship` field. To re-create `defaultValue`, you can use `resolveInput` though note that if you're using autoincrement ids, you need to return the id as number, not a string like you would provide to GraphQL, e.g. `{ connect: { id: 1 } }` rather than `{ connect: { id: "1" } }`. If you were using `withMeta: false`, please open an issue with your use case.
6 changes: 6 additions & 0 deletions .changeset/short-jokes-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/auth': major
'@keystone-next/keystone': major
---

Renamed the `skipAccessControl` argument to `createContext` to `sudo` for consistency with `context.sudo()`.
5 changes: 5 additions & 0 deletions .changeset/silver-boats-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Removed unused `BaseKeystone` type.
5 changes: 5 additions & 0 deletions .changeset/twelve-apples-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Fixed lists with `graphql.omit: ['query']` causing issues in the Admin UI.
6 changes: 6 additions & 0 deletions .changeset/twenty-buttons-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/keystone': patch
'@keystone-next/api-tests-legacy': patch
---

Improved error message for bad relationship filter inputs.
5 changes: 5 additions & 0 deletions .changeset/violet-lions-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

The item view page will only fetch the item once to determine the field modes rather than once per field.
5 changes: 5 additions & 0 deletions .changeset/wise-garlics-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

The Admin UI will skip fetching fields that have a statically set `itemView.fieldMode: 'hidden'` on the item view. The `id` argument to the `KeystoneAdminUIFieldMeta.itemView` GraphQL field can now be omitted which will make `KeystoneAdminUIFieldMetaItemView.fieldMode` return null when there isn't a static field mode. The `itemView` also no longer uses a sudo context when fetching the item in the `KeystoneAdminUIFieldMetaItemView.fieldMode`. Previously, if someone had access to the Admin UI(`ui.isAccessAllowed`) and a field had a `itemView.fieldMode` function that used the `item` argument, someone could bypass access control to determine whether or not an item with a given id exists.
8 changes: 4 additions & 4 deletions design-system/packages/notice/src/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/** @jsx jsx */

import { ReactNode, useMemo } from 'react';
import { jsx, makeId, useId, Stack } from '@keystone-ui/core';
import { jsx, makeId, useId, Stack, MarginProps, Box } from '@keystone-ui/core';
import { AlertOctagonIcon } from '@keystone-ui/icons/icons/AlertOctagonIcon';
import { AlertCircleIcon } from '@keystone-ui/icons/icons/AlertCircleIcon';
import { AlertTriangleIcon } from '@keystone-ui/icons/icons/AlertTriangleIcon';
Expand Down Expand Up @@ -36,7 +36,7 @@ type NoticeProps = {
tone?: ToneKey;
title?: string;
className?: string;
} /* TODO: & MarginProps */;
} & MarginProps;

export const Notice = ({
actions,
Expand All @@ -60,7 +60,7 @@ export const Notice = ({

return (
<ButtonProvider {...buttonContext}>
<div
<Box
css={{
display: 'flex',
flex: 1,
Expand Down Expand Up @@ -97,7 +97,7 @@ export const Notice = ({
</Stack>
)}
</div>
</div>
</Box>
</ButtonProvider>
);
};
4 changes: 2 additions & 2 deletions design-system/website/pages/components/popover.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @jsxRuntime classic */
/** @jsx jsx */

import { jsx, Box } from '@keystone-ui/core';
import { Button } from '@keystone-ui/button';
import { Box, jsx } from '@keystone-ui/core';
import { Popover } from '@keystone-ui/popover';
import { Page } from '../../components/Page';

Expand All @@ -20,7 +20,7 @@ export default function PopoverPage() {
styles for height and width.
</p>
<Popover triggerRenderer={({ triggerProps }) => <Button {...triggerProps}>Click me</Button>}>
<Box width={180} height={80} padding="medium">
<Box tabIndex={0} width={180} height={80} padding="medium">
I'm in a popover!
</Box>
</Popover>
Expand Down
3 changes: 0 additions & 3 deletions docs/pages/docs/apis/context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ context = {
// Internal state
totalResults,
maxTotalResults,
schemaName,

// Deprecated
gqlNames,
Expand Down Expand Up @@ -155,8 +154,6 @@ These properties are used internally by Keystone and generally do not need to be

`maxTotalResults`: The maximum number of results which can be returned before a query limit error is triggered. See [`config.graphql.queryLimits`](./apis/config#graphql).

`schemaName`: The internal name used by Keystone to refer to the GraphQL schema.

### Deprecated

The following properties are deprecated and should not be used.
Expand Down
18 changes: 2 additions & 16 deletions docs/pages/docs/apis/fields.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,6 @@ A `file` field represents a file of any type.

See [`config.files`](./config#files) for details on how to configure your Keystone system with support for the `file` field type.

Options:

- `isRequired` (default: `false`): If `true` then this field can never be set to `null`.

```typescript
import { config, createSchema, list } from '@keystone-next/keystone';
import { file } from '@keystone-next/keystone/fields';
Expand All @@ -644,9 +640,7 @@ export default config({
lists: createSchema({
ListName: list({
fields: {
repo: file({
isRequired: true,
}),
repo: file(),
/* ... */
},
}),
Expand All @@ -662,10 +656,6 @@ An `image` field represents an image file, i.e. `.jpg`, `.png`, `.webp`, or `.gi

See [`config.images`](./config#images) for details on how to configure your Keystone system with support for the `image` field type.

Options:

- `isRequired` (default: `false`): If `true` then this field can never be set to `null`.

```typescript
import { config, createSchema, list } from '@keystone-next/keystone';
import { image } from '@keystone-next/keystone/fields';
Expand All @@ -674,9 +664,7 @@ export default config({
lists: createSchema({
ListName: list({
fields: {
avatar: image({
isRequired: true,
}),
avatar: image(),
/* ... */
},
}),
Expand Down Expand Up @@ -733,7 +721,6 @@ export default config({

(coming soon)

- `isRequired` (default: `false`): If `true` then this field can never be set to `null`.
- `cloudinary`: Configuration for the connected Cloudinary account.
- `cloudName`
- `apiKey`
Expand All @@ -749,7 +736,6 @@ export default config({
ListName: list({
fields: {
fieldName: cloudinaryImage({
isRequired: true,
cloudinary: {
cloudName: process.env.CLOUDINARY_CLOUD_NAME,
apiKey: process.env.CLOUDINARY_API_KEY,
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/assets-cloud/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -303,7 +303,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/assets-local/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -281,7 +281,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/auth/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -224,7 +224,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -470,7 +470,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/ecommerce/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -853,7 +853,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
11 changes: 9 additions & 2 deletions examples-staging/ecommerce/schemas/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ export const Product = list({
price: integer(),
user: relationship({
ref: 'User.products',
defaultValue: ({ context }) =>
context.session?.itemId ? { connect: { id: context.session?.itemId } } : null,
hooks: {
resolveInput({ operation, resolvedData, context }) {
// Default to the currently logged in user on create.
if (operation === 'create' && !resolvedData.user && context.session?.itemId) {
return { connect: { id: context.session?.itemId } };
}
return resolvedData.user;
},
},
}),
},
});
4 changes: 2 additions & 2 deletions examples-staging/embedded-nextjs/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -148,7 +148,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/graphql-api-endpoint/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -399,7 +399,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/roles/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -409,7 +409,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
Loading

0 comments on commit 5144bdf

Please sign in to comment.